diff options
| author | Victor Kareh <vkareh@redhat.com> | 2024-01-18 16:08:49 -0500 |
|---|---|---|
| committer | JF <JF002@users.noreply.github.com> | 2024-08-22 17:34:25 +0200 |
| commit | 2625ed39e5a5d1f2ff2bfe8780d06e37c86e886a (patch) | |
| tree | 990fc9f1951a8e647735f982b5c31ef40d12b36b /src/displayapp/DisplayApp.cpp | |
| parent | a3dbcd62f6faf70b364ec71f49f9edc9e3847b1c (diff) | |
DisplayApp: Go to clock on sleep if no app loaded
When turning off the screen, if there is no actual app loaded (i.e. we
are still in the Launcher, Notifications, QuickSettings, or Settings
screens) we should just reload the Clock app directly.
Diffstat (limited to 'src/displayapp/DisplayApp.cpp')
| -rw-r--r-- | src/displayapp/DisplayApp.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 394a3239..3be7656d 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -293,15 +293,27 @@ void DisplayApp::Refresh() { brightnessController.Lower(); vTaskDelay(100); } - // Don't actually turn off the display for AlwaysOn mode + // Turn brightness down (or set to AlwaysOn mode) if (settingsController.GetAlwaysOnDisplay()) { brightnessController.Set(Controllers::BrightnessController::Levels::AlwaysOn); + } else { + brightnessController.Set(Controllers::BrightnessController::Levels::Off); + } + // Since the active screen is not really an app, go back to Clock. + if (currentApp == Apps::Launcher || currentApp == Apps::Notifications || currentApp == Apps::QuickSettings || + currentApp == Apps::Settings) { + LoadScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None); + // Wait for the clock app to load before moving on. + while (!lv_task_handler()) { + }; + } + // Turn LCD display off (or set to low power for AlwaysOn mode) + if (settingsController.GetAlwaysOnDisplay()) { lcd.LowPowerOn(); // Record idle entry time alwaysOnTickCount = 0; alwaysOnStartTime = xTaskGetTickCount(); } else { - brightnessController.Set(Controllers::BrightnessController::Levels::Off); lcd.Sleep(); } PushMessageToSystemTask(Pinetime::System::Messages::OnDisplayTaskSleeping); |
