Do not allow 2POS warning to be set in middle position.

This commit is contained in:
Raphael Coeffic
2021-12-09 09:51:30 +01:00
parent 571cae732c
commit b29771c425
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -732,9 +732,9 @@ void menuModelSetup(event_t event)
uint8_t curr_state = (states & 0x07);
// remove old setting
g_model.switchWarningState &= ~(0x07 << (3 * i));
// add the new one
g_model.switchWarningState |= ((curr_state + 1) & 0x03)
<< (3 * i);
// add the new one (if switch UP and 2POS, jump directly to DOWN)
curr_state += (curr_state != 1 || IS_CONFIG_3POS(i) ? 1 : 2);
g_model.switchWarningState |= (curr_state & 0x03) << (3 * i);
storageDirty(EE_MODEL);
#if defined(PCBXLITE)
s_editMode = 0;
+3 -3
View File
@@ -707,9 +707,9 @@ void menuModelSetup(event_t event)
uint8_t curr_state = (states & 0x07);
// remove old setting
g_model.switchWarningState &= ~(0x07 << (3 * i));
// add the new one
g_model.switchWarningState |= ((curr_state + 1) & 0x03)
<< (3 * i);
// add the new one (if switch UP and 2POS, jump directly to DOWN)
curr_state += (curr_state != 1 || IS_CONFIG_3POS(i) ? 1 : 2);
g_model.switchWarningState |= (curr_state & 0x03) << (3 * i);
storageDirty(EE_MODEL);
}
c = (" " STR_CHAR_UP "-" STR_CHAR_DOWN)[states & 0x03];