Fixes #1017: Startup key stuck display
This commit is contained in:
+21
-5
@@ -159,22 +159,38 @@ void killEvents(uint8_t event)
|
||||
}
|
||||
}
|
||||
|
||||
void clearKeyEvents()
|
||||
bool clearKeyEvents()
|
||||
{
|
||||
#if defined(PCBSKY9X)
|
||||
CoTickDelay(100); // 200ms
|
||||
#endif
|
||||
|
||||
// loop until all keys are up
|
||||
#if !defined(BOOT)
|
||||
tmr10ms_t deadline = get_tmr10ms() + 300; // wait no more than 3 seconds
|
||||
#endif
|
||||
|
||||
while (keyDown()) {
|
||||
|
||||
#if defined(SIMU)
|
||||
while (keyDown()) SIMU_SLEEP(1/*ms*/);
|
||||
#elif defined(PCBSTD) && defined(ROTARY_ENCODER_NAVIGATION) && !defined(TELEMETREZ)
|
||||
while (keyDown()) { wdt_reset(); rotencPoll(); }
|
||||
SIMU_SLEEP_NORET(1/*ms*/);
|
||||
#else
|
||||
while (keyDown()) wdt_reset();
|
||||
wdt_reset();
|
||||
#endif
|
||||
|
||||
#if defined(PCBSTD) && defined(ROTARY_ENCODER_NAVIGATION) && !defined(TELEMETREZ)
|
||||
rotencPoll();
|
||||
#endif
|
||||
|
||||
#if !defined(BOOT)
|
||||
if (get_tmr10ms() >= deadline) {
|
||||
//timeout expired, at least one key stuck
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
memclear(keys, sizeof(keys));
|
||||
putEvent(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -269,7 +269,7 @@ extern uint8_t s_evt;
|
||||
|
||||
#define putEvent(evt) s_evt = evt
|
||||
|
||||
void clearKeyEvents();
|
||||
bool clearKeyEvents();
|
||||
void pauseEvents(uint8_t enuk);
|
||||
void killEvents(uint8_t enuk);
|
||||
|
||||
|
||||
+12
-1
@@ -1116,7 +1116,18 @@ void checkAll()
|
||||
}
|
||||
#endif
|
||||
|
||||
clearKeyEvents();
|
||||
if (!clearKeyEvents()) {
|
||||
displayPopup(STR_KEYSTUCK);
|
||||
tmr10ms_t tgtime = get_tmr10ms() + 500;
|
||||
while (tgtime != get_tmr10ms()) {
|
||||
#if defined(SIMU)
|
||||
SIMU_SLEEP(1);
|
||||
#elif defined(CPUARM)
|
||||
CoTickDelay(1);
|
||||
#endif
|
||||
wdt_reset();
|
||||
}
|
||||
}
|
||||
|
||||
START_SILENCE_PERIOD();
|
||||
}
|
||||
|
||||
@@ -354,6 +354,7 @@ extern uint8_t main_thread_running;
|
||||
#define getADC_bandgap()
|
||||
|
||||
#define SIMU_SLEEP(x) do { if (!main_thread_running) return; sleep(x/*ms*/); } while (0)
|
||||
#define SIMU_SLEEP_NORET(x) do { sleep(x/*ms*/); } while (0)
|
||||
|
||||
void simuSetKey(uint8_t key, bool state);
|
||||
void simuSetTrim(uint8_t trim, bool state);
|
||||
|
||||
@@ -426,6 +426,7 @@ const pm_char STR_EEPROM_CONVERTING[] PROGMEM = TR_EEPROM_CONVERTING;
|
||||
const pm_char STR_THROTTLEWARN[] PROGMEM = TR_THROTTLEWARN;
|
||||
const pm_char STR_ALARMSWARN[] PROGMEM = TR_ALARMSWARN;
|
||||
const pm_char STR_SWITCHWARN[] PROGMEM = TR_SWITCHWARN;
|
||||
const pm_char STR_KEYSTUCK[] PROGMEM = TR_KEYSTUCK;
|
||||
|
||||
const pm_char STR_SPEAKER_VOLUME[] PROGMEM = TR_SPEAKER_VOLUME;
|
||||
const pm_char STR_LCD[] PROGMEM = TR_LCD;
|
||||
|
||||
@@ -591,6 +591,7 @@ extern const pm_char STR_EEPROM_CONVERTING[];
|
||||
extern const pm_char STR_THROTTLEWARN[];
|
||||
extern const pm_char STR_ALARMSWARN[];
|
||||
extern const pm_char STR_SWITCHWARN[];
|
||||
extern const pm_char STR_KEYSTUCK[];
|
||||
|
||||
extern const pm_char STR_SPEAKER_VOLUME[];
|
||||
extern const pm_char STR_LCD[];
|
||||
|
||||
@@ -730,6 +730,7 @@
|
||||
#define TR_THROTTLEWARN "PLYNU"
|
||||
#define TR_ALARMSWARN "ALARMU"
|
||||
#define TR_SWITCHWARN "POZICE"
|
||||
#define TR_KEYSTUCK "Key stuck"
|
||||
#define TR_INVERT_THR "Invertovat plyn?"
|
||||
#define TR_SPEAKER_VOLUME INDENT "Hlasitost"
|
||||
#define TR_LCD "LCD"
|
||||
|
||||
@@ -734,6 +734,7 @@
|
||||
#define TR_THROTTLEWARN "GAS"
|
||||
#define TR_ALARMSWARN "ALARM"
|
||||
#define TR_SWITCHWARN "SCHALTER"
|
||||
#define TR_KEYSTUCK "Key stuck"
|
||||
#define TR_INVERT_THR TR("Gas umkehren?","Vollgas hinten?") // Th9x 9XR
|
||||
#define TR_SPEAKER_VOLUME INDENT "Lautstärke"
|
||||
#define TR_LCD "Bildschirm"
|
||||
|
||||
@@ -756,6 +756,7 @@
|
||||
#define TR_THROTTLEWARN "THROTTLE"
|
||||
#define TR_ALARMSWARN "ALARMS"
|
||||
#define TR_SWITCHWARN TR("SWITCH","CONTROL")
|
||||
#define TR_KEYSTUCK "Key stuck"
|
||||
#define TR_INVERT_THR TR("Invert Thr?","Invert Throttle?")
|
||||
#define TR_SPEAKER_VOLUME INDENT "Volume" // TODO could be TR_VOLUME ?
|
||||
#define TR_LCD "LCD"
|
||||
|
||||
@@ -727,6 +727,7 @@
|
||||
#define TR_THROTTLEWARN "ACELERADOR"
|
||||
#define TR_ALARMSWARN "ALARMAS"
|
||||
#define TR_SWITCHWARN "INTERPTOR"
|
||||
#define TR_KEYSTUCK "Key stuck"
|
||||
#define TR_INVERT_THR TR("Invertir Acel?", "Invertir Acel.?")
|
||||
#define TR_SPEAKER_VOLUME INDENT "Volumen"
|
||||
#define TR_LCD "LCD"
|
||||
|
||||
@@ -727,6 +727,7 @@
|
||||
#define TR_THROTTLEWARN "THROTTLE"
|
||||
#define TR_ALARMSWARN "ALARMS"
|
||||
#define TR_SWITCHWARN TR("SWITCH","CONTROL")
|
||||
#define TR_KEYSTUCK "Key stuck"
|
||||
#define TR_INVERT_THR TR("Invert Thr?","Invert Throttle?")
|
||||
#define TR_SPEAKER_VOLUME INDENT "Volume"
|
||||
#define TR_LCD "LCD"
|
||||
|
||||
@@ -727,6 +727,7 @@
|
||||
#define TR_THROTTLEWARN "GAZ"
|
||||
#define TR_ALARMSWARN "SON"
|
||||
#define TR_SWITCHWARN TR("INTERS","CONTROLES")
|
||||
#define TR_KEYSTUCK "Key stuck"
|
||||
#define TR_INVERT_THR "Inverser Gaz?"
|
||||
#define TR_SPEAKER_VOLUME INDENT "Volume"
|
||||
#define TR_LCD "Afficheur"
|
||||
|
||||
@@ -727,6 +727,7 @@
|
||||
#define TR_THROTTLEWARN "MOTORE"
|
||||
#define TR_ALARMSWARN "ALLARMI"
|
||||
#define TR_SWITCHWARN "CONTROLLI"
|
||||
#define TR_KEYSTUCK "Key stuck"
|
||||
#define TR_INVERT_THR "Inverti Mot?"
|
||||
#define TR_SPEAKER_VOLUME "Volume Audio"
|
||||
#define TR_LCD "LCD"
|
||||
|
||||
@@ -727,6 +727,7 @@
|
||||
#define TR_THROTTLEWARN "GAZ"
|
||||
#define TR_ALARMSWARN "ALARM"
|
||||
#define TR_SWITCHWARN TR("Przełą","Kontrola")
|
||||
#define TR_KEYSTUCK "Key stuck"
|
||||
#define TR_INVERT_THR TR("Odw.Gaz?","Odwróć gaz?")
|
||||
#define TR_SPEAKER_VOLUME INDENT "Głośność"
|
||||
#define TR_LCD "LCD"
|
||||
|
||||
@@ -727,6 +727,7 @@
|
||||
#define TR_THROTTLEWARN "ACELERAD"
|
||||
#define TR_ALARMSWARN "ALARMES"
|
||||
#define TR_SWITCHWARN "CHAVES"
|
||||
#define TR_KEYSTUCK "Key stuck"
|
||||
#define TR_INVERT_THR "Inverte Acel?"
|
||||
#define TR_SPEAKER_VOLUME INDENT "Volume"
|
||||
#define TR_LCD "LCD"
|
||||
|
||||
@@ -727,6 +727,7 @@
|
||||
#define TR_THROTTLEWARN "GAS"
|
||||
#define TR_ALARMSWARN "ALARM"
|
||||
#define TR_SWITCHWARN "BRYTARE"
|
||||
#define TR_KEYSTUCK "Key stuck"
|
||||
#define TR_INVERT_THR TR("Invert.Gas?", "Invertera Gasen?")
|
||||
#define TR_SPEAKER_VOLUME INDENT "Volym"
|
||||
#define TR_LCD "LCD"
|
||||
|
||||
Reference in New Issue
Block a user