Skip to content

Commit 0d26438

Browse files
committed
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.
1 parent a3dbcd6 commit 0d26438

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/displayapp/DisplayApp.cpp

+14-2
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,27 @@ void DisplayApp::Refresh() {
293293
brightnessController.Lower();
294294
vTaskDelay(100);
295295
}
296-
// Don't actually turn off the display for AlwaysOn mode
296+
// Turn brightness down (or set to AlwaysOn mode)
297297
if (settingsController.GetAlwaysOnDisplay()) {
298298
brightnessController.Set(Controllers::BrightnessController::Levels::AlwaysOn);
299+
} else {
300+
brightnessController.Set(Controllers::BrightnessController::Levels::Off);
301+
}
302+
// Since the active screen is not really an app, go back to Clock.
303+
if (currentApp == Apps::Launcher || currentApp == Apps::Notifications || currentApp == Apps::QuickSettings ||
304+
currentApp == Apps::Settings) {
305+
LoadScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None);
306+
// Wait for the clock app to load before moving on.
307+
while (!lv_task_handler()) {
308+
};
309+
}
310+
// Turn LCD display off (or set to low power for AlwaysOn mode)
311+
if (settingsController.GetAlwaysOnDisplay()) {
299312
lcd.LowPowerOn();
300313
// Record idle entry time
301314
alwaysOnTickCount = 0;
302315
alwaysOnStartTime = xTaskGetTickCount();
303316
} else {
304-
brightnessController.Set(Controllers::BrightnessController::Levels::Off);
305317
lcd.Sleep();
306318
}
307319
PushMessageToSystemTask(Pinetime::System::Messages::OnDisplayTaskSleeping);

0 commit comments

Comments
 (0)