Compare commits

...

1 commit

Author SHA1 Message Date
Jean-François Milants 3b3701c1b5 Restore brightness level when closing the Flashlight application
The brightness level is stored when entering the app, and restored when closing it. Based on another fixed suggested by serosi.

Co-authored-by: serosi <68392668+serosi@users.noreply.github.com>
2024-03-14 21:20:41 +01:00
2 changed files with 3 additions and 2 deletions

View file

@ -15,7 +15,7 @@ namespace {
}
FlashLight::FlashLight(System::SystemTask& systemTask, Controllers::BrightnessController& brightnessController)
: systemTask {systemTask}, brightnessController {brightnessController} {
: systemTask {systemTask}, brightnessController {brightnessController}, backupBrightnessLevel {brightnessController.Level()} {
brightnessController.Set(Controllers::BrightnessController::Levels::Low);
@ -52,6 +52,7 @@ FlashLight::FlashLight(System::SystemTask& systemTask, Controllers::BrightnessCo
FlashLight::~FlashLight() {
lv_obj_clean(lv_scr_act());
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
brightnessController.Set(backupBrightnessLevel);
systemTask.PushMessage(Pinetime::System::Messages::EnableSleeping);
}

View file

@ -27,7 +27,7 @@ namespace Pinetime {
Controllers::BrightnessController& brightnessController;
Controllers::BrightnessController::Levels brightnessLevel = Controllers::BrightnessController::Levels::High;
Controllers::BrightnessController::Levels backupBrightnessLevel;
lv_obj_t* flashLight;
lv_obj_t* backgroundAction;
lv_obj_t* indicators[3];