[Horus] Refactoring for the new fatal errors
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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_
|
||||
|
||||
Reference in New Issue
Block a user