feat: Stuck key test for COLORLCD (#1289)

* Stuck key test for COLORLCD #1271

* always start with the first button, no matter what this button is.

* Add LED  error

* Move LED_ERROR_END to ensure runs after dlg close

Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
eshifri
2022-01-09 12:24:43 +10:00
committed by GitHub
co-authored by Peter Feerick
parent 293b8edd4b
commit d30c5f46bc
+29 -1
View File
@@ -726,7 +726,35 @@ void checkAll()
#endif
#if defined(COLORLCD)
#warning "KEYSTUCK Message Not Yet Implemented"
if (!waitKeysReleased()) {
auto dlg = new FullScreenDialog(WARNING_TYPE_ALERT, STR_KEYSTUCK);
LED_ERROR_BEGIN();
AUDIO_ERROR_MESSAGE(AU_ERROR);
tmr10ms_t tgtime = get_tmr10ms() + 500;
uint32_t keys = readKeys();
std::string strKeys("");
const char STR_VKEYS[] = TR_VKEYS;
const int len = int(LEN_VKEYS[0]);
char s[6];
s[5] = 0;
for (int i = 0; i < (int)TRM_BASE; i++) {
if (keys & (1 << i)) {
strncpy(s, &STR_VKEYS[i * len], len);
strKeys += s;
}
}
dlg->setMessage(strKeys.c_str());
dlg->setCloseCondition([tgtime]() {
if (tgtime >= get_tmr10ms() && keyDown()) {
return false;
} else {
return true;
}
});
dlg->runForever();
LED_ERROR_END();
}
#else
if (!waitKeysReleased()) {
showMessageBox(STR_KEYSTUCK);