diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 4bd53424e0..0eb4be3bc1 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -184,14 +184,14 @@ namespace Pinetime { if (status != settings.notificationStatus) { settingsChanged = true; } - // Disable always on screen while sleep mode is enabled - if (settings.alwaysOnDisplay.enabled) { - if (status == Notification::Sleep) { - settings.alwaysOnDisplay.state = false; - } else { + // Disable always on screen while sleep mode is enabled + if (settings.alwaysOnDisplay.enabled) { + if (status == Notification::Sleep) { + settings.alwaysOnDisplay.state = false; + } else { settings.alwaysOnDisplay.state = true; - } - } + } + } settings.notificationStatus = status; }; @@ -225,10 +225,10 @@ namespace Pinetime { if (state != settings.alwaysOnDisplay.enabled) { settingsChanged = true; } - settings.alwaysOnDisplay.enabled = state; - // the always on state and enabled flags should always match - // if the setting is being modified by the user - SetAlwaysOnDisplay(state); + settings.alwaysOnDisplay.enabled = state; + // the always on state and enabled flags should always match + // if the setting is being modified by the user + SetAlwaysOnDisplay(state); } bool GetAlwaysOnDisplaySetting() const { @@ -312,8 +312,8 @@ namespace Pinetime { // To enable disabling it durring notificationsleep, differenciate between // the setting being on, and the setting being set by the user struct alwaysOnDisplayData { - bool enabled = false; - bool state = false; + bool enabled = false; + bool state = false; }; struct SettingsData { @@ -321,7 +321,7 @@ namespace Pinetime { uint32_t stepsGoal = 10000; uint32_t screenTimeOut = 15000; - alwaysOnDisplayData alwaysOnDisplay; + alwaysOnDisplayData alwaysOnDisplay; ClockType clockType = ClockType::H24; Notification notificationStatus = Notification::On; diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index d91b16fe79..71684f81e0 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -190,8 +190,8 @@ void DisplayApp::Refresh() { if (!currentScreen->IsRunning()) { LoadPreviousScreen(); } - int lvglWaitTime = lv_task_handler(); - // while in always on mode, throttle LVGL events to 4Hz + int lvglWaitTime = lv_task_handler(); + // while in always on mode, throttle LVGL events to 4Hz queueTimeout = std::max(lvglWaitTime, 250); } else { queueTimeout = portMAX_DELAY; @@ -234,13 +234,13 @@ void DisplayApp::Refresh() { brightnessController.Lower(); vTaskDelay(100); } - // Don't actually turn off the display for AlwaysOn mode - if (!settingsController.GetAlwaysOnDisplay()) { - brightnessController.Set(Controllers::BrightnessController::Levels::Off); + // Don't actually turn off the display for AlwaysOn mode + if (settingsController.GetAlwaysOnDisplay()) { + brightnessController.Set(Controllers::BrightnessController::Levels::Lowest); + } else { + brightnessController.Set(Controllers::BrightnessController::Levels::Off); lcd.Sleep(); - } else { - brightnessController.Set(Controllers::BrightnessController::Levels::Lowest); - } + } PushMessageToSystemTask(Pinetime::System::Messages::OnDisplayTaskSleeping); state = States::Idle; break; diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 2b895b56ba..37bd2f407c 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -195,10 +195,10 @@ void SystemTask::Work() { doNotGoToSleep = true; break; case Messages::GoToRunning: - // spi doesn't go to sleep for always on mode - if (!settingsController.GetAlwaysOnDisplay()) { + // spi doesn't go to sleep for always on mode + if (!settingsController.GetAlwaysOnDisplay()) { spi.Wakeup(); - } + } // Double Tap needs the touch screen to be in normal mode if (!settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) { @@ -324,11 +324,11 @@ void SystemTask::Work() { spiNorFlash.Sleep(); } - // If the spi goes to sleep, AlwaysOn will not update the screen while dim, and the screen colors invert - // upon wakeup - if (!settingsController.GetAlwaysOnDisplay()) { + // If the spi goes to sleep, AlwaysOn will not update the screen while dim, and the screen colors invert + // upon wakeup + if (!settingsController.GetAlwaysOnDisplay()) { spi.Sleep(); - } + } // Double Tap needs the touch screen to be in normal mode if (!settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) {