Switch warning fix for Horus (#3516)
This commit is contained in:
committed by
Bertrand Songis
parent
f3d6dfea94
commit
0fad67a8ea
@@ -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) {
|
||||
|
||||
@@ -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_
|
||||
|
||||
@@ -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<NUM_SWITCHES; i++) {
|
||||
bool enabled = ((g_model.switchWarningState >> (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<NUM_SWITCHES; i++) {
|
||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||
if (!READ_ONLY() && attr && l_posHorz==current) {
|
||||
// g_model.switchWarningEnable ^= (1 << i);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
unsigned int state = ((g_model.switchWarningState >> (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;
|
||||
}
|
||||
|
||||
@@ -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<NUM_SWITCHES; i++) {
|
||||
g_model.switchWarningState |= (1 << (3*i));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user