Author: mark9064 <30447455+mark9064@users.noreply.github.com>
aod: fix flashlight brightness restore
src/displayapp/screens/FlashLight.cpp | 2 ++ src/displayapp/screens/FlashLight.h | 1 +
diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp index 1b7cf39ce7e8849a5298afd422a65a72407352dc..f169fac121e916e2e9b42659fc73c3f3f5071557 100644 --- a/src/displayapp/screens/FlashLight.cpp +++ b/src/displayapp/screens/FlashLight.cpp @@ -17,6 +17,7 @@ FlashLight::FlashLight(System::SystemTask& systemTask, Controllers::BrightnessController& brightnessController) : systemTask {systemTask}, brightnessController {brightnessController} { + previousBrightnessLevel = brightnessController.Level(); brightnessController.Set(Controllers::BrightnessController::Levels::Low); flashLight = lv_label_create(lv_scr_act(), nullptr); @@ -52,6 +53,7 @@ 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(previousBrightnessLevel); systemTask.PushMessage(Pinetime::System::Messages::EnableSleeping); } diff --git a/src/displayapp/screens/FlashLight.h b/src/displayapp/screens/FlashLight.h index 2b710ed595f67fd32dd48e941b48059e87e70aa9..c5404e93f92f5956adb5a1bc986bcbec9a989de3 100644 --- a/src/displayapp/screens/FlashLight.h +++ b/src/displayapp/screens/FlashLight.h @@ -27,6 +27,7 @@ Pinetime::System::SystemTask& systemTask; Controllers::BrightnessController& brightnessController; Controllers::BrightnessController::Levels brightnessLevel = Controllers::BrightnessController::Levels::High; + Controllers::BrightnessController::Levels previousBrightnessLevel; lv_obj_t* flashLight; lv_obj_t* backgroundAction;