From 59d2ef8aa100f6cf01486cb5920ecab4bbe214a0 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Tue, 12 Dec 2017 22:01:32 +0100 Subject: [PATCH] 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 --- radio/src/gui/128x64/popups.cpp | 2 ++ radio/src/gui/212x64/popups.cpp | 2 ++ radio/src/gui/480x272/popups.cpp | 2 ++ radio/src/opentx.cpp | 23 +++-------------------- radio/src/tasks_arm.cpp | 5 ----- radio/src/tasks_arm.h | 3 +++ 6 files changed, 12 insertions(+), 25 deletions(-) diff --git a/radio/src/gui/128x64/popups.cpp b/radio/src/gui/128x64/popups.cpp index 69de13404..264330d2b 100644 --- a/radio/src/gui/128x64/popups.cpp +++ b/radio/src/gui/128x64/popups.cpp @@ -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) diff --git a/radio/src/gui/212x64/popups.cpp b/radio/src/gui/212x64/popups.cpp index a6c83bfe4..40d73451c 100644 --- a/radio/src/gui/212x64/popups.cpp +++ b/radio/src/gui/212x64/popups.cpp @@ -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) diff --git a/radio/src/gui/480x272/popups.cpp b/radio/src/gui/480x272/popups.cpp index f627ae0ef..d26ccff61 100644 --- a/radio/src/gui/480x272/popups.cpp +++ b/radio/src/gui/480x272/popups.cpp @@ -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) diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index db4004a24..def103f0d 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -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; } diff --git a/radio/src/tasks_arm.cpp b/radio/src/tasks_arm.cpp index eed69616a..4756a23ab 100644 --- a/radio/src/tasks_arm.cpp +++ b/radio/src/tasks_arm.cpp @@ -88,11 +88,6 @@ uint16_t stackAvailable() volatile uint16_t timeForcePowerOffPressed = 0; -void resetForcePowerOffRequest() -{ - timeForcePowerOffPressed = 0; -} - bool isForcePowerOffRequested() { if (pwrOffPressed()) { diff --git a/radio/src/tasks_arm.h b/radio/src/tasks_arm.h index b34aad065..abd0e66d7 100644 --- a/radio/src/tasks_arm.h +++ b/radio/src/tasks_arm.h @@ -73,4 +73,7 @@ extern TaskStack audioStack; void tasksStart(); +extern volatile uint16_t timeForcePowerOffPressed; +inline void resetForcePowerOffRequest() {timeForcePowerOffPressed = 0; } + #endif // _TASKS_ARM_H_