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.
This commit is contained in:
Victor Kareh 2024-01-18 16:08:49 -05:00 committed by JF
parent a3dbcd62f6
commit 2625ed39e5

View file

@ -293,15 +293,27 @@ void DisplayApp::Refresh() {
brightnessController.Lower(); brightnessController.Lower();
vTaskDelay(100); vTaskDelay(100);
} }
// Don't actually turn off the display for AlwaysOn mode // Turn brightness down (or set to AlwaysOn mode)
if (settingsController.GetAlwaysOnDisplay()) { if (settingsController.GetAlwaysOnDisplay()) {
brightnessController.Set(Controllers::BrightnessController::Levels::AlwaysOn); 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(); lcd.LowPowerOn();
// Record idle entry time // Record idle entry time
alwaysOnTickCount = 0; alwaysOnTickCount = 0;
alwaysOnStartTime = xTaskGetTickCount(); alwaysOnStartTime = xTaskGetTickCount();
} else { } else {
brightnessController.Set(Controllers::BrightnessController::Levels::Off);
lcd.Sleep(); lcd.Sleep();
} }
PushMessageToSystemTask(Pinetime::System::Messages::OnDisplayTaskSleeping); PushMessageToSystemTask(Pinetime::System::Messages::OnDisplayTaskSleeping);