[Horus] Refactoring for the new fatal errors

This commit is contained in:
Bertrand Songis
2016-08-31 01:04:11 +02:00
parent 855814655e
commit 82b9ecc155
25 changed files with 165 additions and 75 deletions
+26
View File
@@ -63,4 +63,30 @@ swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t e
return value;
}
void drawFatalErrorScreen(const char * message)
{
lcdClear();
lcdDrawText(LCD_W/2, LCD_H/2-20, message, DBLSIZE|CENTERED|TEXT_BGCOLOR);
lcdRefresh();
}
void runFatalErrorScreen(const char * message)
{
while (1) {
drawFatalErrorScreen(message);
uint8_t refresh = false;
while (1) {
uint32_t pwr_check = pwrCheck();
if (pwr_check == e_power_off) {
boardOff();
}
else if (pwr_check == e_power_press) {
refresh = true;
}
else if (pwr_check == e_power_on && refresh) {
break;
}
SIMU_SLEEP_NORET(1);
}
}
}
+2
View File
@@ -105,6 +105,8 @@ void drawStringWithIndex(coord_t x, coord_t y, const char * str, int idx, LcdFla
int editChoice(coord_t x, coord_t y, const char * values, int value, int min, int max, LcdFlags flags, event_t event);
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags flags, event_t event);
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags flags, event_t event);
void drawFatalErrorScreen(const char * message);
void runFatalErrorScreen(const char * message);
#endif
#endif // _GUI_COMMON_H_