mirror of
https://github.com/opentx/opentx.git
synced 2025-07-19 22:35:12 +03:00
Rework rssi code a bit (#5507)
* Switch backlight on when displaying a warning. This is especially visible on the power off RSSI warning. This will also show the other warnings at start with backlight, even when blocklight is set to always off. But my X9D+ will switch its backlight on after boot once even with backlight on, so backlight=off is not so off as it seems. * Rework power rssi code a bit - Cleanup shutdown_confirm code - allow x9d+ to be compiled as power button too to be able to test these things on the x9d+ - Fix shutoff after 10s in warning dialog on x9d - Make warning dialog always turn on backlight * Revert CMakeLists.txt
This commit is contained in:
parent
977262232a
commit
59d2ef8aa1
6 changed files with 12 additions and 25 deletions
|
@ -92,6 +92,8 @@ void showAlertBox(const pm_char * title, const pm_char * text, const char * acti
|
|||
lcdRefresh();
|
||||
lcdSetContrast();
|
||||
clearKeyEvents();
|
||||
backlightOn();
|
||||
checkBacklight();
|
||||
}
|
||||
|
||||
void runPopupWarning(event_t event)
|
||||
|
|
|
@ -83,6 +83,8 @@ void showAlertBox(const char * title, const char * text, const char * action, ui
|
|||
lcdRefresh();
|
||||
lcdSetContrast();
|
||||
clearKeyEvents();
|
||||
backlightOn();
|
||||
checkBacklight();
|
||||
}
|
||||
|
||||
void runPopupWarning(event_t event)
|
||||
|
|
|
@ -65,6 +65,8 @@ void showAlertBox(const char * title, const char * text, const char * action, ui
|
|||
lcdRefresh();
|
||||
lcdSetContrast();
|
||||
clearKeyEvents();
|
||||
backlightOn();
|
||||
checkBacklight();
|
||||
}
|
||||
|
||||
void showMessageBox(const char * title)
|
||||
|
|
|
@ -2814,25 +2814,10 @@ uint32_t pwrCheck()
|
|||
}
|
||||
if (get_tmr10ms() - pwr_press_time > PWR_PRESS_SHUTDOWN_DELAY) {
|
||||
#if defined(SHUTDOWN_CONFIRMATION)
|
||||
while (1) {
|
||||
lcdRefreshWait();
|
||||
lcdClear();
|
||||
POPUP_CONFIRMATION("Confirm Shutdown");
|
||||
event_t evt = getEvent(false);
|
||||
DISPLAY_WARNING(evt);
|
||||
lcdRefresh();
|
||||
if (warningResult == true) {
|
||||
pwr_check_state = PWR_CHECK_OFF;
|
||||
return e_power_off;
|
||||
}
|
||||
else if (!warningText) {
|
||||
// shutdown has been cancelled
|
||||
pwr_check_state = PWR_CHECK_PAUSED;
|
||||
return e_power_on;
|
||||
}
|
||||
}
|
||||
while (1)
|
||||
#else
|
||||
while ((TELEMETRY_STREAMING() && !g_eeGeneral.disableRssiPoweroffAlarm)) {
|
||||
#endif
|
||||
lcdRefreshWait();
|
||||
lcdClear();
|
||||
POPUP_CONFIRMATION("Confirm Shutdown");
|
||||
|
@ -2852,7 +2837,6 @@ uint32_t pwrCheck()
|
|||
haptic.play(15, 3, PLAY_NOW);
|
||||
pwr_check_state = PWR_CHECK_OFF;
|
||||
return e_power_off;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
drawShutdownAnimation(pwrPressedDuration(), message);
|
||||
|
@ -2890,9 +2874,8 @@ uint32_t pwrCheck()
|
|||
if (TELEMETRY_STREAMING()) {
|
||||
RAISE_ALERT(STR_MODEL, STR_MODEL_STILL_POWERED, STR_PRESS_ENTER_TO_CONFIRM, AU_MODEL_STILL_POWERED);
|
||||
while (TELEMETRY_STREAMING()) {
|
||||
#if defined(CPUARM)
|
||||
resetForcePowerOffRequest();
|
||||
CoTickDelay(10);
|
||||
#endif
|
||||
if (pwrPressed()) {
|
||||
return e_power_on;
|
||||
}
|
||||
|
|
|
@ -88,11 +88,6 @@ uint16_t stackAvailable()
|
|||
|
||||
volatile uint16_t timeForcePowerOffPressed = 0;
|
||||
|
||||
void resetForcePowerOffRequest()
|
||||
{
|
||||
timeForcePowerOffPressed = 0;
|
||||
}
|
||||
|
||||
bool isForcePowerOffRequested()
|
||||
{
|
||||
if (pwrOffPressed()) {
|
||||
|
|
|
@ -73,4 +73,7 @@ extern TaskStack<AUDIO_STACK_SIZE> audioStack;
|
|||
|
||||
void tasksStart();
|
||||
|
||||
extern volatile uint16_t timeForcePowerOffPressed;
|
||||
inline void resetForcePowerOffRequest() {timeForcePowerOffPressed = 0; }
|
||||
|
||||
#endif // _TASKS_ARM_H_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue