From b2be5344958d38fb362bab3691fc104f0f049853 Mon Sep 17 00:00:00 2001 From: Michele Bini Date: Sun, 10 Apr 2022 10:31:53 +0200 Subject: Persist brightness level of flashlight, and start as on diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp index dba79a4..266e089 100644 --- a/src/displayapp/screens/FlashLight.cpp +++ b/src/displayapp/screens/FlashLight.cpp @@ -9,6 +9,9 @@ namespace { auto* screen = static_cast(obj->user_data); screen->OnClickEvent(obj, event); } + + Pinetime::Controllers::BrightnessController::Levels brightnessLevel = Pinetime::Controllers::BrightnessController::Levels::High; + } FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app, @@ -21,7 +24,6 @@ FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app, { brightnessController.Backup(); - brightnessLevel = brightnessController.Level(); flashLight = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); @@ -39,6 +41,8 @@ FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app, lv_obj_align(indicators[2], indicators[1], LV_ALIGN_OUT_RIGHT_MID, 8, 0); SetIndicators(); + // brightnessLevel = brightnessController.Level(); + brightnessController.Set(brightnessLevel); SetColors(); backgroundAction = lv_label_create(lv_scr_act(), nullptr); diff --git a/src/displayapp/screens/FlashLight.h b/src/displayapp/screens/FlashLight.h index e91a103..ebc69f7 100644 --- a/src/displayapp/screens/FlashLight.h +++ b/src/displayapp/screens/FlashLight.h @@ -26,12 +26,10 @@ namespace Pinetime { Pinetime::System::SystemTask& systemTask; Controllers::BrightnessController& brightnessController; - Controllers::BrightnessController::Levels brightnessLevel; - lv_obj_t* flashLight; lv_obj_t* backgroundAction; lv_obj_t* indicators[3]; - bool isOn = false; + bool isOn = true; }; } } -- cgit v0.10.2