fix: Pot and slider warnings weren't being set properly on radio or syncing with Companion (#1981)

- fix Companion yaml model read and write
- B&W radios treat bit values the same as color to avoid unnecessary complication for Companion and radio conversions
- B&W radios default is therefore off for all pots and sliders
- B&W radios fix runtime warnings check
- all radios fix to save last pot or slider position when checked and mode AUTO on change of model or power off
- all radios do not display Pots Warning in model setup if no pots or sliders supported
This commit is contained in:
Neil Horne
2022-06-07 13:04:40 +10:00
committed by GitHub
parent cd59eac89f
commit cba4e07ce1
7 changed files with 45 additions and 35 deletions
+1 -1
View File
@@ -906,7 +906,7 @@ void menuModelSetup(event_t event)
}
else {
LcdFlags flags = ((menuHorizontalPosition==i+1) && attr) ? BLINK : 0;
if ((!attr || menuHorizontalPosition >= 0) && !(g_model.potsWarnEnabled & (1 << i))) {
if ((!attr || menuHorizontalPosition >= 0) && (g_model.potsWarnEnabled & (1 << i))) {
flags |= INVERS;
}
+2 -2
View File
@@ -405,7 +405,7 @@ void menuModelSetup(event_t event)
0, // Global functions
0, // ADC Jitter filter
REGISTRATION_ID_ROWS
LABEL(InternalModule),
@@ -822,7 +822,7 @@ void menuModelSetup(event_t event)
}
#endif
LcdFlags flags = ((menuHorizontalPosition==i+1) && attr) ? BLINK : 0;
if ((!attr || menuHorizontalPosition >= 0) && !(g_model.potsWarnEnabled & (1 << i))) {
if ((!attr || menuHorizontalPosition >= 0) && (g_model.potsWarnEnabled & (1 << i))) {
flags |= INVERS;
}
+1 -1
View File
@@ -243,7 +243,7 @@ void storageFlushCurrentModel()
if (g_model.potsWarnMode == POTS_WARN_AUTO) {
for (int i=0; i<NUM_POTS+NUM_SLIDERS; i++) {
if (!(g_model.potsWarnEnabled & (1 << i))) {
if (g_model.potsWarnEnabled & (1 << i)) {
SAVE_POT_POSITION(i);
}
}
+3 -3
View File
@@ -796,7 +796,7 @@ void checkSwitches()
if (!IS_POT_SLIDER_AVAILABLE(POT1+i)) {
continue;
}
if (!(g_model.potsWarnEnabled & (1 << i))) {
if (g_model.potsWarnEnabled & (1 << i)) {
if (abs(g_model.potsWarnPosition[i] - GET_LOWRES_POT_POSITION(i)) > 1) {
if (++numWarnings < 6) {
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, NUM_STICKS + 1 + i, INVERS);
@@ -887,7 +887,7 @@ void logicalSwitchesTimerTick()
}
msg = luaSetStickySwitchBuffer.read();
}
// Update logical switches
for (uint8_t fm=0; fm<MAX_FLIGHT_MODES; fm++) {
for (uint8_t i=0; i<MAX_LOGICAL_SWITCHES; i++) {
@@ -1004,7 +1004,7 @@ void logicalSwitchesReset()
LS_LAST_VALUE(fm, i) = CS_LAST_VALUE_INIT;
}
}
luaSetStickySwitchBuffer.clear();
}