aboutsummaryrefslogtreecommitdiffstats
path: root/src/displayapp/screens/FlashLight.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp/screens/FlashLight.cpp')
-rw-r--r--src/displayapp/screens/FlashLight.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp
index 1b7cf39c..7e0caff1 100644
--- a/src/displayapp/screens/FlashLight.cpp
+++ b/src/displayapp/screens/FlashLight.cpp
@@ -15,8 +15,9 @@ namespace {
}
FlashLight::FlashLight(System::SystemTask& systemTask, Controllers::BrightnessController& brightnessController)
- : systemTask {systemTask}, brightnessController {brightnessController} {
+ : wakeLock(systemTask), brightnessController {brightnessController} {
+ previousBrightnessLevel = brightnessController.Level();
brightnessController.Set(Controllers::BrightnessController::Levels::Low);
flashLight = lv_label_create(lv_scr_act(), nullptr);
@@ -46,13 +47,13 @@ FlashLight::FlashLight(System::SystemTask& systemTask, Controllers::BrightnessCo
backgroundAction->user_data = this;
lv_obj_set_event_cb(backgroundAction, EventHandler);
- systemTask.PushMessage(Pinetime::System::Messages::DisableSleeping);
+ wakeLock.Lock();
}
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);
- systemTask.PushMessage(Pinetime::System::Messages::EnableSleeping);
+ brightnessController.Set(previousBrightnessLevel);
}
void FlashLight::SetColors() {