diff --git a/radio/src/gui/menu_model.cpp b/radio/src/gui/menu_model.cpp index 4ff2fab0b..170ae6f37 100644 --- a/radio/src/gui/menu_model.cpp +++ b/radio/src/gui/menu_model.cpp @@ -1305,7 +1305,7 @@ void menuModelSetup(uint8_t event) case EVT_KEY_LONG(KEY_ENTER): killEvents(event); if (potMode == 1) { - g_model.potPosition[m_posHorz-1] = getValue(MIXSRC_FIRST_POT+m_posHorz-1) >> 4; + SAVE_POT_POSITION(m_posHorz-1); AUDIO_WARNING1(); eeDirty(EE_MODEL); } diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 145aaee3c..87158a79f 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -2460,9 +2460,9 @@ void opentxClose() #if defined(PCBTARANIS) if ((g_model.nPotsToWarn >> 6) == 2) { - for (uint8_t i=0; i> 3; + SAVE_POT_POSITION(i); eeDirty(EE_MODEL); } #endif diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 7e7de1c5a..2b5e4a323 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -361,6 +361,9 @@ enum PotType { #define IS_POT_MULTIPOS(x) (false) #endif +#define GET_LOWRES_POT_POSITION(i) (getValue(MIXSRC_FIRST_POT+(i)) >> 4) +#define SAVE_POT_POSITION(i) g_model.potPosition[i] = GET_LOWRES_POT_POSITION(i) + #if ROTARY_ENCODERS > 0 #define IF_ROTARY_ENCODERS(x) x, #else diff --git a/radio/src/switches.cpp b/radio/src/switches.cpp index da815eaee..5450daf65 100644 --- a/radio/src/switches.cpp +++ b/radio/src/switches.cpp @@ -552,9 +552,9 @@ void checkSwitches() evalFlightModeMixes(e_perout_mode_normal, 0); bad_pots = 0; for (uint8_t i=0; i> 4)) > 1)) { + if (!(g_model.nPotsToWarn & (1 << i)) && (abs(g_model.potPosition[i] - GET_LOWRES_POT_POSITION(i)) > 1)) { warn = true; - bad_pots |= (1<> 4)) > 1) { + if (abs(g_model.potPosition[i] - GET_LOWRES_POT_POSITION(i)) > 1) { switch (i) { case 0: case 1: case 2: - lcd_putc(60+i*(5*FW)+2*FW+2, 6*FH-2, g_model.potPosition[i] > (getValue(MIXSRC_FIRST_POT+i) >> 4) ? 126 : 127); + lcd_putc(60+i*(5*FW)+2*FW+2, 6*FH-2, g_model.potPosition[i] > GET_LOWRES_POT_POSITION(i) ? 126 : 127); break; case 3: case 4: - lcd_putc(60+i*(5*FW)+2*FW+2, 6*FH-2, g_model.potPosition[i] > (getValue(MIXSRC_FIRST_POT+i) >> 4) ? '\300' : '\301'); + lcd_putc(60+i*(5*FW)+2*FW+2, 6*FH-2, g_model.potPosition[i] > GET_LOWRES_POT_POSITION(i) ? '\300' : '\301'); break; } flags = INVERS;