1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-20 23:05: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:
Arne Schwabe 2017-12-12 22:01:32 +01:00 committed by Bertrand Songis
parent 977262232a
commit 59d2ef8aa1
6 changed files with 12 additions and 25 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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;
}

View file

@ -88,11 +88,6 @@ uint16_t stackAvailable()
volatile uint16_t timeForcePowerOffPressed = 0;
void resetForcePowerOffRequest()
{
timeForcePowerOffPressed = 0;
}
bool isForcePowerOffRequested()
{
if (pwrOffPressed()) {

View file

@ -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_