diff --git a/radio/src/gui/gui_helpers.cpp b/radio/src/gui/gui_helpers.cpp index 4a57a22c0..3c4c78892 100644 --- a/radio/src/gui/gui_helpers.cpp +++ b/radio/src/gui/gui_helpers.cpp @@ -357,6 +357,13 @@ bool isSwitchAvailableInMixes(int swtch) return isSwitchAvailable(swtch, MixesContext); } +#if defined(COLORLCD) +bool isSwitchWarningStateAvailable(int state) +{ + return (state != 2); // two pos switch - middle state not available +} +#endif // #if defined(COLORLCD) + bool isSwitchAvailableInTimers(int swtch) { if (swtch >= 0) { diff --git a/radio/src/gui/gui_helpers.h b/radio/src/gui/gui_helpers.h index e63b8d997..6301b4929 100644 --- a/radio/src/gui/gui_helpers.h +++ b/radio/src/gui/gui_helpers.h @@ -60,4 +60,8 @@ bool isSensorAvailable(int sensor); bool modelHasNotes(); +#if defined(COLORLCD) +bool isSwitchWarningStateAvailable(int state); +#endif // #if defined(COLORLCD) + #endif // _GUI_HELPERS_H_ diff --git a/radio/src/gui/horus/menu_model_setup.cpp b/radio/src/gui/horus/menu_model_setup.cpp index a3a833604..acc4cc6bf 100644 --- a/radio/src/gui/horus/menu_model_setup.cpp +++ b/radio/src/gui/horus/menu_model_setup.cpp @@ -420,7 +420,14 @@ bool menuModelSetup(evt_t event) killEvents(event); START_NO_HIGHLIGHT(); getMovedSwitch(); - g_model.switchWarningState = switches_states; + for (int i=0; i> (3*i)) & 0x07); + if (enabled) { + g_model.switchWarningState &= ~(0x07 << (3*i)); + unsigned int newState = (switches_states >> (2*i) & 0x03) + 1; + g_model.switchWarningState |= (newState << (3*i)); + } + } AUDIO_WARNING1(); storageDirty(EE_MODEL); } @@ -433,7 +440,6 @@ bool menuModelSetup(evt_t event) for (int i=0, current=0; i> (3*i)) & 0x07); @@ -443,22 +449,10 @@ bool menuModelSetup(evt_t event) } char s[3]; s[0] = 'A' + i; - int max; - if (state == 0) { - s[1] = 'x'; - max = 2; - } - else if (IS_3POS(i)) { - s[1] = "\300-\301"[state-1]; - max = 3; - } - else { - s[1] = "\300\301"[state-1]; - max = 2; - } + s[1] = "x\300-\301"[state]; s[2] = '\0'; lcdDrawText(MODEL_SETUP_2ND_COLUMN+i*25, y, s, color|(menuHorizontalPosition==current ? attr : 0)); - if (attr && menuHorizontalPosition==current) CHECK_INCDEC_MODELVAR_ZERO(event, state, max); + if (attr && menuHorizontalPosition==current) CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, state, 3, IS_3POS(i) ? 0 : isSwitchWarningStateAvailable); newStates |= (state << (3*i)); ++current; } diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index d726450e4..a302d5f4c 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -470,6 +470,10 @@ void modelDefault(uint8_t id) strcpy(g_model.screenData[0].layoutName, "Layout2P1"); extern const WidgetFactory * defaultWidget; customScreens[0]->createWidget(0, defaultWidget); + // enable switch warnings + for (int i=0; i