More pot checking - still need to find how to read the pot's position on the warning screen, the current solution only works the first time.

This commit is contained in:
Andre Bernet
2013-12-02 15:51:12 +01:00
parent 452e987fca
commit 43b0c00e11
2 changed files with 10 additions and 6 deletions
+8 -4
View File
@@ -2175,6 +2175,9 @@ void checkSwitches()
{
swstate_t last_bad_switches = 0xff;
swstate_t states = g_model.switchWarningStates;
#if defined(PCBTARANIS)
uint8_t bad_pots = 0, last_bad_pots = 0xff;
#endif
while (1) {
@@ -2196,11 +2199,13 @@ void checkSwitches()
perOut(e_perout_mode_inactive_phase, 0);
uint8_t potMode = g_model.nPotsToWarn >> 6;
uint8_t bad_pots = 0, last_bad_pots = 0xff;
bad_pots = 0;
if(potMode)
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) >> 3)) > 2))
if(!(g_model.nPotsToWarn & (1 << i)) && (abs(g_model.potPosition[i] - (getValue(MIXSRC_FIRST_POT+i) >> 3)) > 2)) {
warn = true;
bad_pots |= (1<<i);
}
#else
for (uint8_t i=0; i<MAX_PSWITCH-2; i++)
if (!(g_model.nSwToWarn & (1<<(i-1))))
@@ -2223,14 +2228,13 @@ void checkSwitches()
lcd_putcAtt(60+i*(2*FW+FW/2)+FW, 4*FH+3, c, attr);
}
}
bad_pots = 0;
lcd_outdezAtt(195,4*FH+3,getValue(MIXSRC_FIRST_POT) >> 3,0);
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) >> 3)) > 2) {
lcd_putc(60+i*(5*FW)+2*FW+2, 6*FH-2, g_model.potPosition[i] > (getValue(MIXSRC_FIRST_POT+i) >> 3) ? 127 : 126);
flags = INVERS;
bad_pots |= (1<<i);
}
lcd_putsiAtt(60+i*(5*FW), 6*FH-2, STR_VSRCRAW, NUM_STICKS+1+i, flags);
}
+2 -2
View File
@@ -471,7 +471,7 @@
#define TR_BLOFFBRIGHTNESS INDENT"OFF Brightness"
#define TR_SPLASHSCREEN "Splash screen"
#define TR_THROTTLEWARNING TR("T-Warning","Throttle Warning")
#define TR_SWITCHWARNING TR("S-Warning","Control Warnings")
#define TR_SWITCHWARNING TR("S-Warning","Switch Warning")
#define TR_TIMEZONE TR("Time Zone","GPS Time zone")
#define TR_RXCHANNELORD TR("Rx Channel Ord","Default channel order")
#define TR_SLAVE "Slave"
@@ -580,7 +580,7 @@
#define TR_EEPROMWARN "EEPROM"
#define TR_THROTTLEWARN "THROTTLE"
#define TR_ALARMSWARN "ALARMS"
#define TR_SWITCHWARN "SWITCH"
#define TR_SWITCHWARN TR("SWITCH","CONTROL")
#define TR_INVERT_THR TR("Invert Thr?","Invert Throttle?")
#define TR_SPEAKER_VOLUME INDENT "Volume"
#define TR_LCD "LCD"