fix(yaml): flex switch warnings (#4949)

Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com>
Co-authored-by: 3djc <3djc@gh.com>
Co-authored-by: elecpower <neilh713@tpg.com.au>
This commit is contained in:
Raphael Coeffic
2024-05-03 13:14:50 +10:00
committed by GitHub
co-authored by raphaelcoeffic 3djc elecpower
parent dd87ecb89a
commit 0d6ce7d22d
22 changed files with 174 additions and 101 deletions
+5 -5
View File
@@ -975,7 +975,7 @@ void menuModelSetup(event_t event)
break;
}
swarnstate_t states = g_model.switchWarningState;
swarnstate_t states = g_model.switchWarning;
lcdDrawTextAlignedLeft(y, STR_SWITCHWARNING);
#if defined(PCBXLITE)
@@ -1003,10 +1003,10 @@ void menuModelSetup(event_t event)
swarnstate_t sw_mask = 0;
for(uint8_t i = 0; i < switchGetMaxSwitches(); i++) {
if (SWITCH_WARNING_ALLOWED(i))
if (g_model.switchWarningState & (0x07 << (3 * i)))
if (g_model.switchWarning & (0x07 << (3 * i)))
sw_mask |= (0x07 << (3 * i));
}
g_model.switchWarningState = switches_states & sw_mask;
g_model.switchWarning = switches_states & sw_mask;
AUDIO_WARNING1();
storageDirty(EE_MODEL);
}
@@ -1024,10 +1024,10 @@ void menuModelSetup(event_t event)
l_posHorz == current && old_posHorz >= 0) {
uint8_t curr_state = (states & 0x07);
// remove old setting
g_model.switchWarningState &= ~(0x07 << (3 * i));
g_model.switchWarning &= ~(0x07 << (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);
g_model.switchWarning |= (curr_state & 0x03) << (3 * i);
storageDirty(EE_MODEL);
#if defined(PCBXLITE)
s_editMode = 0;