1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 08:15:17 +03:00

Bug found in Pots Warning (Auto mode)

This commit is contained in:
bsongis 2014-06-02 10:58:30 +02:00
parent 207fc721fa
commit 0ea3daa4c4
4 changed files with 11 additions and 8 deletions

View file

@ -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);
}

View file

@ -2462,7 +2462,7 @@ void opentxClose()
if ((g_model.nPotsToWarn >> 6) == 2) {
for (uint8_t i=0; i<NUM_POTS; i++)
if (!(g_model.nPotsToWarn & (1 << i)))
g_model.potPosition[i] = getValue(MIXSRC_FIRST_POT+i) >> 3;
SAVE_POT_POSITION(i);
eeDirty(EE_MODEL);
}
#endif

View file

@ -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

View file

@ -552,7 +552,7 @@ void checkSwitches()
evalFlightModeMixes(e_perout_mode_normal, 0);
bad_pots = 0;
for (uint8_t i=0; i<NUM_POTS; i++) {
if (!(g_model.nPotsToWarn & (1 << i)) && (abs(g_model.potPosition[i] - (getValue(MIXSRC_FIRST_POT+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<<i);
}
@ -598,16 +598,16 @@ void checkSwitches()
for (uint8_t i=0; i<NUM_POTS; i++) {
if (!(g_model.nPotsToWarn & (1 << i))) {
uint8_t flags = 0;
if (abs(g_model.potPosition[i] - (getValue(MIXSRC_FIRST_POT+i) >> 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;