Switch warnings on stock again

This commit is contained in:
Andre Bernet
2014-02-01 14:55:10 +01:00
parent fcce76cfa4
commit 3a5b41ae54
2 changed files with 18 additions and 11 deletions
+17 -10
View File
@@ -2258,12 +2258,15 @@ void checkSwitches()
} }
} }
#else #else
uint8_t nSwWarn = g_model.nSwToWarn; for (uint8_t i=0; i<NUM_SWITCHES; i++) {
nSwWarn=(nSwWarn<<1)|(nSwWarn&1); // duplicate first bit because states has first two bits for ID, but nSwToWarn has only one if (!(g_model.nSwToWarn & (1<<i))) {
for (uint8_t i=0; i<NUM_PSWITCH-2; i++) { if (i == 0) {
if (!(nSwWarn & (1<<i))) if((states & 0x03) != (switches_states & 0x03))
if((states & (1<<i)) != (switches_states & (1<<i))) warn = true;
}
else if((states & (1<<i+1)) != (switches_states & (1<<i+1)))
warn = true; warn = true;
}
} }
#endif #endif
@@ -2308,11 +2311,15 @@ void checkSwitches()
if (last_bad_switches != switches_states) { if (last_bad_switches != switches_states) {
MESSAGE(STR_SWITCHWARN, NULL, STR_PRESSANYKEYTOSKIP, last_bad_switches == 0xff ? AU_SWITCH_ALERT : AU_NONE); MESSAGE(STR_SWITCHWARN, NULL, STR_PRESSANYKEYTOSKIP, last_bad_switches == 0xff ? AU_SWITCH_ALERT : AU_NONE);
uint8_t x = 2; uint8_t x = 2;
for (uint8_t i=1; i<NUM_PSWITCH-1; i++) { for (uint8_t i=0; i<NUM_SWITCHES; i++) {
uint8_t attr = (states & (1 << (i-1))) == (switches_states & (1 << (i-1))) ? 0 : INVERS; uint8_t attr;
if(!(nSwWarn & (1<<(i-1)))) putsSwitches(x, 5*FH, (i>2?(i+1):1+(states&0x3)), attr); if (i == 0)
if (i == 1 && attr) i++; attr = ((states & 0x03) != (switches_states & 0x03)) ? INVERS : 0;
if (i != 1) x += 3*FW+FW/2; else
attr = (states & (1 << i+1)) == (switches_states & (1 << i+1)) ? 0 : INVERS;
if(!(g_model.nSwToWarn & (1<<i)))
putsSwitches(x, 5*FH, (i>0?(i+3):(switches_states&0x3)+1), attr);
x += 3*FW+FW/2;
} }
#endif #endif
lcdRefresh(); lcdRefresh();
+1 -1
View File
@@ -485,7 +485,7 @@
#define TR_BLOFFBRIGHTNESS INDENT"OFF Brightness" #define TR_BLOFFBRIGHTNESS INDENT"OFF Brightness"
#define TR_SPLASHSCREEN "Splash screen" #define TR_SPLASHSCREEN "Splash screen"
#define TR_THROTTLEWARNING TR("T-Warning","Throttle Warning") #define TR_THROTTLEWARNING TR("T-Warning","Throttle Warning")
#define TR_SWITCHWARNING TR("C-Warning","Control Warning") #define TR_SWITCHWARNING TR("S-Warning","Switch Warning")
#define TR_POTWARNING TR("Pot Warn.","Pot Warning") #define TR_POTWARNING TR("Pot Warn.","Pot Warning")
#define TR_TIMEZONE TR("Time Zone","GPS Time zone") #define TR_TIMEZONE TR("Time Zone","GPS Time zone")
#define TR_RXCHANNELORD TR("Rx Channel Ord","Default channel order") #define TR_RXCHANNELORD TR("Rx Channel Ord","Default channel order")