From b0183efaf112f59b0135534f0964a01052fc98aa Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Tue, 25 Apr 2017 21:25:46 +0200 Subject: [PATCH] Fixes #4841 --- companion/src/eeprominterface.cpp | 14 ++++++++++++-- companion/src/radiodata.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp index d13b0e108..ae8bad2bc 100644 --- a/companion/src/eeprominterface.cpp +++ b/companion/src/eeprominterface.cpp @@ -552,8 +552,8 @@ QString RawSource::toString(const ModelData * model, const GeneralSettings * con result = QString(generalSettings->potName[genAryIdx]); else if (isSlider(&genAryIdx)) result = QString(generalSettings->sliderName[genAryIdx]); - else - result = QString(generalSettings->stickName[index]); + else if (isStick(&genAryIdx)) + result = QString(generalSettings->stickName[genAryIdx]); } if (result.isEmpty()) result = getCurrentFirmware()->getAnalogInputName(index);; @@ -608,6 +608,16 @@ QString RawSource::toString(const ModelData * model, const GeneralSettings * con } } +bool RawSource::isStick(int * stickIndex) const +{ + if (type == SOURCE_TYPE_STICK && index < getBoardCapability(getCurrentBoard(), Board::Sticks)) { + if (stickIndex) + *stickIndex = index; + return true; + } + return false; +} + bool RawSource::isPot(int * potsIndex) const { if (type == SOURCE_TYPE_STICK && diff --git a/companion/src/radiodata.h b/companion/src/radiodata.h index d04dbabd4..9fe15f7b9 100644 --- a/companion/src/radiodata.h +++ b/companion/src/radiodata.h @@ -231,6 +231,7 @@ class RawSource { } bool isTimeBased() const; + bool isStick(int * potsIndex = NULL) const; bool isPot(int * potsIndex = NULL) const; bool isSlider(int * sliderIndex = NULL) const;