From 33f05d6b869ec4e4d808386f90743c17b3e9dd16 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 27 Aug 2024 10:47:47 +0000 Subject: [PATCH 1/9] Show notification indicator when a notification is available --- src/displayapp/screens/WatchFaceAnalog.cpp | 10 ++++++- .../screens/WatchFaceCasioStyleG7710.cpp | 10 ++++++- src/displayapp/screens/WatchFaceDigital.cpp | 10 ++++++- src/displayapp/screens/WatchFaceInfineat.cpp | 2 +- .../screens/WatchFacePineTimeStyle.cpp | 26 +++++++++++++++++-- .../screens/WatchFacePineTimeStyle.h | 1 + src/displayapp/screens/WatchFaceTerminal.cpp | 4 +++ 7 files changed, 57 insertions(+), 6 deletions(-) diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index 80a1c8b9b5..836a77e65c 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -249,7 +249,15 @@ void WatchFaceAnalog::Refresh() { notificationState = notificationManager.AreNewNotificationsAvailable(); if (notificationState.IsUpdated()) { - lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get())); + if (notificationState.Get()) { + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); + } else if (notificationManager.NbNotifications() > 0) { + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF)); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); + } else { + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); + } } currentDateTime = dateTimeController.CurrentDateTime(); diff --git a/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp b/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp index c695f852fe..e5dd473825 100644 --- a/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp +++ b/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp @@ -219,7 +219,15 @@ void WatchFaceCasioStyleG7710::Refresh() { notificationState = notificatioManager.AreNewNotificationsAvailable(); if (notificationState.IsUpdated()) { - lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get())); + if (notificationState.Get()) { + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); + } else if (notificatioManager.NbNotifications() > 0) { + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF)); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); + } else { + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); + } } currentDateTime = std::chrono::time_point_cast(dateTimeController.CurrentDateTime()); diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 2e00ee9819..3bc61a8031 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -98,7 +98,15 @@ void WatchFaceDigital::Refresh() { notificationState = notificationManager.AreNewNotificationsAvailable(); if (notificationState.IsUpdated()) { - lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get())); + if (notificationState.Get()) { + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); + } else if (notificationManager.NbNotifications() > 0) { + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF)); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); + } else { + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); + } } currentDateTime = std::chrono::time_point_cast(dateTimeController.CurrentDateTime()); diff --git a/src/displayapp/screens/WatchFaceInfineat.cpp b/src/displayapp/screens/WatchFaceInfineat.cpp index 4c6fc196ac..3b503a66f8 100644 --- a/src/displayapp/screens/WatchFaceInfineat.cpp +++ b/src/displayapp/screens/WatchFaceInfineat.cpp @@ -393,7 +393,7 @@ void WatchFaceInfineat::UpdateSelected(lv_obj_t* object, lv_event_t event) { void WatchFaceInfineat::Refresh() { notificationState = notificationManager.AreNewNotificationsAvailable(); if (notificationState.IsUpdated()) { - lv_obj_set_hidden(notificationIcon, !notificationState.Get()); + lv_obj_set_hidden(notificationIcon, !(notificationState.Get() || (notificationManager.NbNotifications() > 0))); lv_obj_align(notificationIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0); } diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index e56031f74a..9c314375a5 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -444,6 +444,18 @@ void WatchFacePineTimeStyle::SetBatteryIcon() { batteryIcon.SetBatteryPercentage(batteryPercent); } +void WatchFacePineTimeStyle::AlignIcons() { + bool notif = notificationState.Get() || notificationNbState.Get(); + if (notif && bleState.Get()) { + lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 8, 25); + lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25); + } else if (notif && !bleState.Get()) { + lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); + } else { + lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); + } +} + void WatchFacePineTimeStyle::Refresh() { isCharging = batteryController.IsCharging(); if (isCharging.IsUpdated()) { @@ -471,8 +483,18 @@ void WatchFacePineTimeStyle::Refresh() { } notificationState = notificationManager.AreNewNotificationsAvailable(); - if (notificationState.IsUpdated()) { - lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get())); + notificationNbState = notificationManager.NbNotifications() > 0; + if (notificationState.IsUpdated() || notificationNbState.IsUpdated()) { + if (notificationState.Get()) { + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF)); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); + } else if (notificationNbState.Get()) { + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); + } else { + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); + } + AlignIcons(); } currentDateTime = dateTimeController.CurrentDateTime(); diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.h b/src/displayapp/screens/WatchFacePineTimeStyle.h index 72537095f9..47a1dabf42 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.h +++ b/src/displayapp/screens/WatchFacePineTimeStyle.h @@ -61,6 +61,7 @@ namespace Pinetime { Utility::DirtyValue> currentDateTime {}; Utility::DirtyValue stepCount {}; Utility::DirtyValue notificationState {}; + Utility::DirtyValue notificationNbState {}; Utility::DirtyValue> currentWeather {}; static Pinetime::Controllers::Settings::Colors GetNext(Controllers::Settings::Colors color); diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp index 96d77741fd..40714245bc 100644 --- a/src/displayapp/screens/WatchFaceTerminal.cpp +++ b/src/displayapp/screens/WatchFaceTerminal.cpp @@ -98,6 +98,10 @@ void WatchFaceTerminal::Refresh() { notificationState = notificationManager.AreNewNotificationsAvailable(); if (notificationState.IsUpdated()) { if (notificationState.Get()) { + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); + lv_label_set_text_static(notificationIcon, "You have mail."); + } else if (notificationManager.NbNotifications() > 0) { + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF)); lv_label_set_text_static(notificationIcon, "You have mail."); } else { lv_label_set_text_static(notificationIcon, ""); From 974174a5aaa23f6265c88b38e9d0a1237334011c Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 27 Aug 2024 10:50:05 +0000 Subject: [PATCH 2/9] Introduce a restricted clock-only-mode when not woken with the button --- src/CMakeLists.txt | 1 + src/FreeRTOSConfig.h | 2 +- src/components/settings/Settings.h | 13 +++- src/displayapp/DisplayApp.cpp | 10 +++- src/displayapp/DisplayApp.h | 3 + src/displayapp/Messages.h | 2 + src/displayapp/fonts/CMakeLists.txt | 2 +- src/displayapp/fonts/fonts.json | 10 ++++ src/displayapp/screens/Symbols.h | 3 + .../screens/settings/SettingWakeUp.cpp | 46 ++++++++++++--- .../screens/settings/SettingWakeUp.h | 22 ++++++- src/libs/lv_conf.h | 3 +- src/systemtask/SystemTask.cpp | 59 +++++++++++++++---- src/systemtask/SystemTask.h | 5 ++ src/touchhandler/TouchHandler.cpp | 20 ++++++- src/touchhandler/TouchHandler.h | 31 +++++++++- 16 files changed, 198 insertions(+), 34 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fd8ece62a6..78b2791793 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -402,6 +402,7 @@ list(APPEND SOURCE_FILES displayapp/widgets/PageIndicator.cpp displayapp/widgets/DotIndicator.cpp displayapp/widgets/StatusIcons.cpp + displayapp/widgets/PopupMessage.cpp ## Settings displayapp/screens/settings/QuickSettings.cpp diff --git a/src/FreeRTOSConfig.h b/src/FreeRTOSConfig.h index 67c33a34cc..930ec7644b 100644 --- a/src/FreeRTOSConfig.h +++ b/src/FreeRTOSConfig.h @@ -62,7 +62,7 @@ #define configTICK_RATE_HZ 1024 #define configMAX_PRIORITIES (3) #define configMINIMAL_STACK_SIZE (120) -#define configTOTAL_HEAP_SIZE (1024 * 40) +#define configTOTAL_HEAP_SIZE (1024 * 35) #define configMAX_TASK_NAME_LEN (4) #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 1 diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 602de3a585..356977d70a 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -13,7 +13,14 @@ namespace Pinetime { enum class WeatherFormat : uint8_t { Metric, Imperial }; enum class Notification : uint8_t { On, Off, Sleep }; enum class ChimesOption : uint8_t { None, Hours, HalfHours }; - enum class WakeUpMode : uint8_t { SingleTap = 0, DoubleTap = 1, RaiseWrist = 2, Shake = 3, LowerWrist = 4 }; + enum class WakeUpMode : uint8_t { + SingleTap = 0, + DoubleTap = 1, + RaiseWrist = 2, + Shake = 3, + LowerWrist = 4, + ButtonUnlocks = 5, + }; enum class Colors : uint8_t { White, Silver, @@ -260,7 +267,7 @@ namespace Pinetime { } }; - std::bitset<5> getWakeUpModes() const { + std::bitset<6> getWakeUpModes() const { return settings.wakeUpMode; } @@ -321,7 +328,7 @@ namespace Pinetime { WatchFaceInfineat watchFaceInfineat; - std::bitset<5> wakeUpMode {0}; + std::bitset<6> wakeUpMode {0}; uint16_t shakeWakeThreshold = 150; Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium; diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 3be7656dc8..1851ee5089 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -30,6 +30,7 @@ #include "displayapp/screens/Weather.h" #include "displayapp/screens/PassKey.h" #include "displayapp/screens/Error.h" +#include "displayapp/screens/Symbols.h" #include "drivers/Cst816s.h" #include "drivers/St7789.h" @@ -101,6 +102,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, spiNorFlash {spiNorFlash}, lvgl {lcd, filesystem}, timer(this, TimerCallback), + popupMessage {Screens::Symbols::lock, 90, 90}, controllers {batteryController, bleController, dateTimeController, @@ -461,6 +463,12 @@ void DisplayApp::Refresh() { RestoreBrightness(); motorController.RunForDuration(15); break; + case Messages::ShowIgnoreTouchPopup: + popupMessage.SetHidden(false); + break; + case Messages::HideIgnoreTouchPopup: + popupMessage.SetHidden(true); + break; } } @@ -584,7 +592,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio currentScreen = std::make_unique(settingsController); break; case Apps::SettingWakeUp: - currentScreen = std::make_unique(settingsController); + currentScreen = std::make_unique(this, settingsController); break; case Apps::SettingDisplay: currentScreen = std::make_unique(this, settingsController); diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index d443b8b217..16883969a4 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -15,6 +15,7 @@ #include "components/timer/Timer.h" #include "components/alarm/AlarmController.h" #include "touchhandler/TouchHandler.h" +#include "displayapp/widgets/PopupMessage.h" #include "displayapp/Messages.h" #include "BootErrors.h" @@ -103,6 +104,8 @@ namespace Pinetime { Pinetime::Components::LittleVgl lvgl; Pinetime::Controllers::Timer timer; + Pinetime::Applications::Widgets::PopupMessage popupMessage; + AppControllers controllers; TaskHandle_t taskHandle; diff --git a/src/displayapp/Messages.h b/src/displayapp/Messages.h index 1418f6bea0..d15a7189d6 100644 --- a/src/displayapp/Messages.h +++ b/src/displayapp/Messages.h @@ -24,6 +24,8 @@ namespace Pinetime { Chime, BleRadioEnableToggle, OnChargingEvent, + ShowIgnoreTouchPopup, + HideIgnoreTouchPopup }; } } diff --git a/src/displayapp/fonts/CMakeLists.txt b/src/displayapp/fonts/CMakeLists.txt index 22627efcad..3f03280818 100644 --- a/src/displayapp/fonts/CMakeLists.txt +++ b/src/displayapp/fonts/CMakeLists.txt @@ -1,5 +1,5 @@ set(FONTS jetbrains_mono_42 jetbrains_mono_76 jetbrains_mono_bold_20 - jetbrains_mono_extrabold_compressed lv_font_sys_48 + jetbrains_mono_extrabold_compressed lv_font_sys_48 lv_font_sys_80 open_sans_light fontawesome_weathericons) find_program(LV_FONT_CONV "lv_font_conv" NO_CACHE REQUIRED HINTS "${CMAKE_SOURCE_DIR}/node_modules/.bin") diff --git a/src/displayapp/fonts/fonts.json b/src/displayapp/fonts/fonts.json index 41c383c0d4..59afed0f5b 100644 --- a/src/displayapp/fonts/fonts.json +++ b/src/displayapp/fonts/fonts.json @@ -64,6 +64,16 @@ "bpp": 1, "size": 48 }, + "lv_font_sys_80": { + "sources": [ + { + "file": "material-design-icons/MaterialIcons-Regular.ttf", + "range": "0xe897" + } + ], + "bpp": 1, + "size": 80 + }, "fontawesome_weathericons": { "sources": [ { diff --git a/src/displayapp/screens/Symbols.h b/src/displayapp/screens/Symbols.h index bd958b285f..323fc73a87 100644 --- a/src/displayapp/screens/Symbols.h +++ b/src/displayapp/screens/Symbols.h @@ -64,6 +64,9 @@ namespace Pinetime { static constexpr const char* flashlight = "\xEF\x80\x8B"; static constexpr const char* paintbrushLg = "\xEE\x90\x8A"; + + // wake-up screenlock icon, from material icons + static constexpr const char* lock = "\xEE\xA2\x97"; } } } diff --git a/src/displayapp/screens/settings/SettingWakeUp.cpp b/src/displayapp/screens/settings/SettingWakeUp.cpp index 4649dc82e2..d610ff8258 100644 --- a/src/displayapp/screens/settings/SettingWakeUp.cpp +++ b/src/displayapp/screens/settings/SettingWakeUp.cpp @@ -8,7 +8,17 @@ using namespace Pinetime::Applications::Screens; -constexpr std::array SettingWakeUp::options; +constexpr std::array SettingWakeUp::options; + +auto SettingWakeUp::CreateScreenList() { + std::array()>, nScreens> screens; + for (size_t i = 0; i < screens.size(); i++) { + screens[i] = [this, i]() -> std::unique_ptr { + return CreateScreen(i); + }; + } + return screens; +} namespace { void event_handler(lv_obj_t* obj, lv_event_t event) { @@ -19,7 +29,16 @@ namespace { } } -SettingWakeUp::SettingWakeUp(Pinetime::Controllers::Settings& settingsController) : settingsController {settingsController} { +SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) + : settingsController {settingsController}, screens {app, 0, CreateScreenList(), Screens::ScreenListModes::UpDown} { +} + +SettingWakeUp::~SettingWakeUp() { + lv_obj_clean(lv_scr_act()); + settingsController.SaveSettings(); +} + +std::unique_ptr SettingWakeUp::CreateScreen(size_t screenNum) { lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr); lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); @@ -43,20 +62,29 @@ SettingWakeUp::SettingWakeUp(Pinetime::Controllers::Settings& settingsController lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); - for (unsigned int i = 0; i < options.size(); i++) { + // cleanup any old pointers + cbOption.fill(nullptr); + + // only loop as far as the list size aĺlows + unsigned int loopMax = screenNum * optionsPerScreen + optionsPerScreen; + if (loopMax > options.size()) { + loopMax = options.size(); + } + + for (unsigned int i = screenNum * optionsPerScreen; i < loopMax; i++) { cbOption[i] = lv_checkbox_create(container1, nullptr); lv_checkbox_set_text(cbOption[i], options[i].name); - if (settingsController.isWakeUpModeOn(static_cast(i))) { + if (settingsController.isWakeUpModeOn(options[i].wakeUpMode)) { lv_checkbox_set_checked(cbOption[i], true); } cbOption[i]->user_data = this; lv_obj_set_event_cb(cbOption[i], event_handler); } + return std::make_unique(screenNum, nScreens, container1); } -SettingWakeUp::~SettingWakeUp() { - lv_obj_clean(lv_scr_act()); - settingsController.SaveSettings(); +bool SettingWakeUp::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + return screens.OnTouchEvent(event); } void SettingWakeUp::UpdateSelected(lv_obj_t* object) { @@ -74,6 +102,8 @@ void SettingWakeUp::UpdateSelected(lv_obj_t* object) { // for example, when setting SingleTap, DoubleTap is unset and vice versa. auto modes = settingsController.getWakeUpModes(); for (size_t i = 0; i < options.size(); ++i) { - lv_checkbox_set_checked(cbOption[i], modes[i]); + if (cbOption[i]) { + lv_checkbox_set_checked(cbOption[i], modes[i]); + } } } diff --git a/src/displayapp/screens/settings/SettingWakeUp.h b/src/displayapp/screens/settings/SettingWakeUp.h index 61edabce34..b7bc4723d0 100644 --- a/src/displayapp/screens/settings/SettingWakeUp.h +++ b/src/displayapp/screens/settings/SettingWakeUp.h @@ -4,7 +4,10 @@ #include #include #include "components/settings/Settings.h" +#include "displayapp/screens/Page.h" #include "displayapp/screens/Screen.h" +#include "displayapp/screens/ScreenList.h" +#include "displayapp/widgets/PageIndicator.h" namespace Pinetime { @@ -13,27 +16,40 @@ namespace Pinetime { class SettingWakeUp : public Screen { public: - SettingWakeUp(Pinetime::Controllers::Settings& settingsController); + SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController); ~SettingWakeUp() override; void UpdateSelected(lv_obj_t* object); + bool OnTouchEvent(TouchEvents event) override; + private: + auto CreateScreenList(); + std::unique_ptr CreateScreen(size_t screenNum); + struct Option { Controllers::Settings::WakeUpMode wakeUpMode; const char* name; }; + static constexpr size_t numOptions = 6; + static constexpr size_t optionsPerScreen = 4; + static constexpr size_t nScreens = 2; + Controllers::Settings& settingsController; - static constexpr std::array options = {{ + + ScreenList screens; + + static constexpr std::array options = {{ {Controllers::Settings::WakeUpMode::SingleTap, "Single Tap"}, {Controllers::Settings::WakeUpMode::DoubleTap, "Double Tap"}, {Controllers::Settings::WakeUpMode::RaiseWrist, "Raise Wrist"}, {Controllers::Settings::WakeUpMode::Shake, "Shake Wake"}, {Controllers::Settings::WakeUpMode::LowerWrist, "Lower Wrist"}, + {Controllers::Settings::WakeUpMode::ButtonUnlocks, "Button Unlock"}, }}; - lv_obj_t* cbOption[options.size()]; + std::array cbOption; }; } } diff --git a/src/libs/lv_conf.h b/src/libs/lv_conf.h index c23647f2c0..9bf21fb841 100644 --- a/src/libs/lv_conf.h +++ b/src/libs/lv_conf.h @@ -419,7 +419,8 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in LV_FONT_DECLARE(jetbrains_mono_76) \ LV_FONT_DECLARE(open_sans_light) \ LV_FONT_DECLARE(fontawesome_weathericons) \ - LV_FONT_DECLARE(lv_font_sys_48) + LV_FONT_DECLARE(lv_font_sys_48) \ + LV_FONT_DECLARE(lv_font_sys_80) /* Enable it if you have fonts with a lot of characters. * The limit depends on the font size, font face and bpp diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 211e19ec81..a4b37dc89e 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -222,7 +222,11 @@ void SystemTask::Work() { state = SystemTaskState::Running; break; case Messages::TouchWakeUp: { - if (touchHandler.ProcessTouchInfo(touchPanel.GetTouchInfo())) { + Pinetime::Controllers::TouchHandler::TouchProcessReply reply; + reply = + touchHandler.ProcessTouchInfo(touchPanel.GetTouchInfo(), + settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::ButtonUnlocks)); + if (reply == Pinetime::Controllers::TouchHandler::TouchProcessReply::TouchEvent) { auto gesture = touchHandler.GestureGet(); if (settingsController.GetNotificationStatus() != Controllers::Settings::Notification::Sleep && gesture != Pinetime::Applications::TouchEvents::None && @@ -230,12 +234,15 @@ void SystemTask::Work() { settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) || (gesture == Pinetime::Applications::TouchEvents::Tap && settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::SingleTap)))) { + touchHandler.SetWokenBy(Pinetime::Controllers::TouchHandler::WokenBy::WakeUpAction, true); GoToRunning(); } } break; } case Messages::GoToSleep: + touchHandler.SetIgnoreTouchPopupHidden(true); + displayApp.PushMessage(Pinetime::Applications::Display::Messages::HideIgnoreTouchPopup); if (doNotGoToSleep) { break; } @@ -254,6 +261,7 @@ void SystemTask::Work() { case Messages::OnNewNotification: if (settingsController.GetNotificationStatus() == Pinetime::Controllers::Settings::Notification::On) { if (state == SystemTaskState::Sleeping) { + touchHandler.SetWokenBy(Pinetime::Controllers::TouchHandler::WokenBy::Other, false); GoToRunning(); } else { displayApp.PushMessage(Pinetime::Applications::Display::Messages::NotifyDeviceActivity); @@ -263,6 +271,7 @@ void SystemTask::Work() { break; case Messages::SetOffAlarm: if (state == SystemTaskState::Sleeping) { + touchHandler.SetWokenBy(Pinetime::Controllers::TouchHandler::WokenBy::Other, false); GoToRunning(); } displayApp.PushMessage(Pinetime::Applications::Display::Messages::AlarmTriggered); @@ -275,6 +284,7 @@ void SystemTask::Work() { case Messages::BleFirmwareUpdateStarted: doNotGoToSleep = true; if (state == SystemTaskState::Sleeping) { + touchHandler.SetWokenBy(Pinetime::Controllers::TouchHandler::WokenBy::Other, false); GoToRunning(); } displayApp.PushMessage(Pinetime::Applications::Display::Messages::BleFirmwareUpdateStarted); @@ -289,6 +299,7 @@ void SystemTask::Work() { NRF_LOG_INFO("[systemtask] FS Started"); doNotGoToSleep = true; if (state == SystemTaskState::Sleeping) { + touchHandler.SetWokenBy(Pinetime::Controllers::TouchHandler::WokenBy::Other, false); GoToRunning(); } // TODO add intent of fs access icon or something @@ -299,24 +310,39 @@ void SystemTask::Work() { // TODO add intent of fs access icon or something break; case Messages::OnTouchEvent: - if (touchHandler.ProcessTouchInfo(touchPanel.GetTouchInfo())) { + Pinetime::Controllers::TouchHandler::TouchProcessReply reply; + reply = + touchHandler.ProcessTouchInfo(touchPanel.GetTouchInfo(), + settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::ButtonUnlocks)); + if (reply == Pinetime::Controllers::TouchHandler::TouchProcessReply::TouchEvent) { displayApp.PushMessage(Pinetime::Applications::Display::Messages::TouchEvent); + } else if (reply == Pinetime::Controllers::TouchHandler::TouchProcessReply::IgnoreTouchPopup) { + displayApp.PushMessage(Pinetime::Applications::Display::Messages::ShowIgnoreTouchPopup); + touchHandler.SetIgnoreTouchPopupHidden(false); } break; case Messages::HandleButtonEvent: { - Controllers::ButtonActions action = Controllers::ButtonActions::None; - if (nrf_gpio_pin_read(Pinetime::PinMap::Button) == 0) { - action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Release); + // if the IgnoreTouchPopup is active the first button event unlocks the device + if (!touchHandler.IsIgnoreTouchPopupHidden()) { + touchHandler.SetWokenBy(Pinetime::Controllers::TouchHandler::WokenBy::Button, false); + touchHandler.SetIgnoreTouchPopupHidden(true); + displayApp.PushMessage(Pinetime::Applications::Display::Messages::HideIgnoreTouchPopup); } else { - action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Press); - // This is for faster wakeup, sacrificing special longpress and doubleclick handling while sleeping - if (IsSleeping()) { - fastWakeUpDone = true; - GoToRunning(); - break; + Controllers::ButtonActions action = Controllers::ButtonActions::None; + if (nrf_gpio_pin_read(Pinetime::PinMap::Button) == 0) { + action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Release); + } else { + action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Press); + touchHandler.SetWokenBy(Pinetime::Controllers::TouchHandler::WokenBy::Button, false); + // This is for faster wakeup, sacrificing special longpress and doubleclick handling while sleeping + if (IsSleeping()) { + fastWakeUpDone = true; + GoToRunning(); + break; + } } + HandleButtonAction(action); } - HandleButtonAction(action); } break; case Messages::HandleButtonTimerEvent: { auto action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Timer); @@ -340,6 +366,8 @@ void SystemTask::Work() { } state = SystemTaskState::Sleeping; + // reset touch restrictions when going to sleep + touchHandler.SetWokenBy(Pinetime::Controllers::TouchHandler::WokenBy::Other, false); break; case Messages::OnNewDay: // We might be sleeping (with TWI device disabled. @@ -354,6 +382,7 @@ void SystemTask::Work() { // if sleeping, we can't send a chime to displayApp yet (SPI flash switched off) // request running first and repush the chime message if (state == SystemTaskState::Sleeping) { + touchHandler.SetWokenBy(Pinetime::Controllers::TouchHandler::WokenBy::Other, false); GoToRunning(); PushMessage(msg); } else { @@ -369,6 +398,7 @@ void SystemTask::Work() { // if sleeping, we can't send a chime to displayApp yet (SPI flash switched off) // request running first and repush the chime message if (state == SystemTaskState::Sleeping) { + touchHandler.SetWokenBy(Pinetime::Controllers::TouchHandler::WokenBy::Other, false); GoToRunning(); PushMessage(msg); } else { @@ -380,6 +410,7 @@ void SystemTask::Work() { batteryController.ReadPowerState(); displayApp.PushMessage(Applications::Display::Messages::OnChargingEvent); if (state == SystemTaskState::Sleeping) { + touchHandler.SetWokenBy(Pinetime::Controllers::TouchHandler::WokenBy::Other, false); GoToRunning(); } break; @@ -391,6 +422,7 @@ void SystemTask::Work() { break; case Messages::OnPairing: if (state == SystemTaskState::Sleeping) { + touchHandler.SetWokenBy(Pinetime::Controllers::TouchHandler::WokenBy::Other, false); GoToRunning(); } displayApp.PushMessage(Pinetime::Applications::Display::Messages::ShowPairingKey); @@ -452,6 +484,9 @@ void SystemTask::UpdateMotion() { motionController.ShouldRaiseWake()) || (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake) && motionController.ShouldShakeWake(settingsController.GetShakeThreshold()))) { + if (state == SystemTaskState::Sleeping) { + touchHandler.SetWokenBy(Pinetime::Controllers::TouchHandler::WokenBy::WakeUpAction, true); + } GoToRunning(); } } diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index 79f1cf444f..20b8ebe7c1 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -53,6 +53,11 @@ namespace Pinetime { class SystemTask { public: enum class SystemTaskState { Sleeping, Running, GoingToSleep, WakingUp }; + // Enum describes how the watch was woken: + // * WakeUpAction: The actions selected in the wakeup settings, single/double tap, raise, shake + // * Button: The hardware button + // * Other: Other things that can wake the watch up, eg. apps and notifications. + enum class WokenBy { WakeUpAction, Button, Other }; SystemTask(Drivers::SpiMaster& spi, Pinetime::Drivers::SpiNorFlash& spiNorFlash, Drivers::TwiMaster& twiMaster, diff --git a/src/touchhandler/TouchHandler.cpp b/src/touchhandler/TouchHandler.cpp index b29f951fcb..55d2eff03d 100644 --- a/src/touchhandler/TouchHandler.cpp +++ b/src/touchhandler/TouchHandler.cpp @@ -33,9 +33,9 @@ Pinetime::Applications::TouchEvents TouchHandler::GestureGet() { return returnGesture; } -bool TouchHandler::ProcessTouchInfo(Drivers::Cst816S::TouchInfos info) { +TouchHandler::TouchProcessReply TouchHandler::ProcessTouchInfo(Drivers::Cst816S::TouchInfos info, bool buttonUnlocksOn) { if (!info.isValid) { - return false; + return TouchHandler::TouchProcessReply::NoAction; } // Only a single gesture per touch @@ -62,5 +62,19 @@ bool TouchHandler::ProcessTouchInfo(Drivers::Cst816S::TouchInfos info) { currentTouchPoint = {info.x, info.y, info.touching}; - return true; + // if the watch was just woken by touch and button must be used to unlock, ignore the first touch event which + // is the touch event that woke the watch. Otherwise the lock-popup will be displayed + if (buttonUnlocksOn && ignoreNextTouchEvent) { + ignoreNextTouchEvent = false; + return TouchHandler::TouchProcessReply::NoAction; + + } else if (!buttonUnlocksOn || wokenBy != WokenBy::WakeUpAction) { + + // if we get to here TouchEvents is allowed and the "ButtonUnlocks" requirement can be overridden + wokenBy = WokenBy::Other; + + return TouchHandler::TouchProcessReply::TouchEvent; + } else { + return TouchHandler::TouchProcessReply::IgnoreTouchPopup; + } } diff --git a/src/touchhandler/TouchHandler.h b/src/touchhandler/TouchHandler.h index a44822552d..2eb997c614 100644 --- a/src/touchhandler/TouchHandler.h +++ b/src/touchhandler/TouchHandler.h @@ -6,13 +6,25 @@ namespace Pinetime { namespace Controllers { class TouchHandler { public: + // Enum describes how the watch was woken: + // * WakeUpAction: The actions selected in the wakeup settings, single/double tap, raise, shake + // * Button: The hardware button + // * Other: Other things that can wake the watch up, eg. apps and notifications. + enum class WokenBy { WakeUpAction, Button, Other }; + + // Enum describes how the reply from ProcessTouchInfo should be interpreted: + // * NoAction: Do nothing, ignore input. + // * TouchEvent: The input should be treated as a normal touch event. + // * IgnoreTouchPopup: Show the popup when ignoring touch input. + enum class TouchProcessReply { NoAction, TouchEvent, IgnoreTouchPopup }; + struct TouchPoint { int x; int y; bool touching; }; - bool ProcessTouchInfo(Drivers::Cst816S::TouchInfos info); + TouchProcessReply ProcessTouchInfo(Drivers::Cst816S::TouchInfos info, bool buttonUnlocksOn); bool IsTouching() const { return currentTouchPoint.touching; @@ -26,12 +38,29 @@ namespace Pinetime { return currentTouchPoint.y; } + void SetIgnoreTouchPopupHidden(bool hidden) { + ignoreTouchPopupHidden = hidden; + } + + bool IsIgnoreTouchPopupHidden() { + return ignoreTouchPopupHidden; + } + + void SetWokenBy(WokenBy woken, bool ifButtonUnlocksIgnoreTouch) { + wokenBy = woken; + ignoreNextTouchEvent = ifButtonUnlocksIgnoreTouch; + } + Pinetime::Applications::TouchEvents GestureGet(); private: Pinetime::Applications::TouchEvents gesture; TouchPoint currentTouchPoint = {}; bool gestureReleased = true; + + WokenBy wokenBy; + bool ignoreNextTouchEvent = false; + bool ignoreTouchPopupHidden = true; }; } } From c28815b727b85b6910463326f1e22e8ab2e8a8a6 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 27 Aug 2024 11:10:52 +0000 Subject: [PATCH 3/9] added missing files --- src/displayapp/screens/Page.h | 29 +++++++++++++++++++ src/displayapp/widgets/PopupMessage.cpp | 37 +++++++++++++++++++++++++ src/displayapp/widgets/PopupMessage.h | 24 ++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 src/displayapp/screens/Page.h create mode 100644 src/displayapp/widgets/PopupMessage.cpp create mode 100644 src/displayapp/widgets/PopupMessage.h diff --git a/src/displayapp/screens/Page.h b/src/displayapp/screens/Page.h new file mode 100644 index 0000000000..b670630fa6 --- /dev/null +++ b/src/displayapp/screens/Page.h @@ -0,0 +1,29 @@ +#pragma once + +#include +#include +#include "displayapp/screens/Screen.h" +#include "displayapp/widgets/PageIndicator.h" + +namespace Pinetime { + + namespace Applications { + namespace Screens { + + class Page : public Screen { + public: + Page(uint8_t screenID, uint8_t numScreens, lv_obj_t* contentObj) : contentObj {contentObj}, pageIndicator(screenID, numScreens) { + pageIndicator.Create(); + } + + ~Page() override { + lv_obj_clean(lv_scr_act()); + } + + private: + lv_obj_t* contentObj = nullptr; + Widgets::PageIndicator pageIndicator; + }; + } + } +} diff --git a/src/displayapp/widgets/PopupMessage.cpp b/src/displayapp/widgets/PopupMessage.cpp new file mode 100644 index 0000000000..7bfcc97e23 --- /dev/null +++ b/src/displayapp/widgets/PopupMessage.cpp @@ -0,0 +1,37 @@ +#include "displayapp/widgets/PopupMessage.h" +#include + +using namespace Pinetime::Applications::Widgets; + +PopupMessage::PopupMessage(const char* msg, int16_t h, int16_t w) : message {msg}, height {h}, width {w} { +} + +void PopupMessage::Create() { + btnPopup = lv_btn_create(lv_scr_act(), nullptr); + btnPopup->user_data = this; + lv_obj_set_size(btnPopup, height, width); + lv_obj_align(btnPopup, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); + lv_obj_set_style_local_bg_opa(btnPopup, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_60); + lv_obj_set_style_local_text_font(btnPopup, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_80); + lv_obj_t* lblMessage = lv_label_create(btnPopup, nullptr); + lv_label_set_text_static(lblMessage, message); + lv_obj_set_hidden(btnPopup, isHidden); +} + +void PopupMessage::SetHidden(bool hidden) { + if (isHidden == hidden) { + return; + } + isHidden = hidden; + // create/delete on demand + if (btnPopup == nullptr && !isHidden) { + Create(); + } else if (btnPopup != nullptr) { + lv_obj_del(btnPopup); + btnPopup = nullptr; + } +} + +bool PopupMessage::IsHidden() { + return isHidden; +} diff --git a/src/displayapp/widgets/PopupMessage.h b/src/displayapp/widgets/PopupMessage.h new file mode 100644 index 0000000000..ca993912fe --- /dev/null +++ b/src/displayapp/widgets/PopupMessage.h @@ -0,0 +1,24 @@ +#pragma once +#include + +namespace Pinetime { + namespace Applications { + namespace Widgets { + class PopupMessage { + public: + // The caller owns the message string, it is not copied. + PopupMessage(const char* msg, int16_t h, int16_t w); + void Create(); + void SetHidden(bool hidden); + bool IsHidden(); + + private: + const char* message; + lv_obj_t* btnPopup = nullptr; + bool isHidden = true; + int16_t height; + int16_t width; + }; + } + } +} From 2d0ddbb63cf69664d5241606d7be0da98bbf9011 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 27 Aug 2024 11:20:45 +0000 Subject: [PATCH 4/9] Remove AlignIcons --- src/displayapp/screens/WatchFacePineTimeStyle.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index 9c314375a5..df47c0a918 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -444,18 +444,6 @@ void WatchFacePineTimeStyle::SetBatteryIcon() { batteryIcon.SetBatteryPercentage(batteryPercent); } -void WatchFacePineTimeStyle::AlignIcons() { - bool notif = notificationState.Get() || notificationNbState.Get(); - if (notif && bleState.Get()) { - lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 8, 25); - lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25); - } else if (notif && !bleState.Get()) { - lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); - } else { - lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); - } -} - void WatchFacePineTimeStyle::Refresh() { isCharging = batteryController.IsCharging(); if (isCharging.IsUpdated()) { @@ -494,7 +482,6 @@ void WatchFacePineTimeStyle::Refresh() { } else { lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); } - AlignIcons(); } currentDateTime = dateTimeController.CurrentDateTime(); From 31a564c2f03097c012fe5252c95a7102912138bd Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 27 Aug 2024 12:49:29 +0000 Subject: [PATCH 5/9] Remove notificationNbState which does not seems needed --- src/displayapp/screens/WatchFacePineTimeStyle.cpp | 11 +++++------ src/displayapp/screens/WatchFacePineTimeStyle.h | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index df47c0a918..c3e9a3c72d 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -471,16 +471,15 @@ void WatchFacePineTimeStyle::Refresh() { } notificationState = notificationManager.AreNewNotificationsAvailable(); - notificationNbState = notificationManager.NbNotifications() > 0; - if (notificationState.IsUpdated() || notificationNbState.IsUpdated()) { + if (notificationState.IsUpdated()) { if (notificationState.Get()) { - lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF)); + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); - } else if (notificationNbState.Get()) { - lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); + } else if (notificatioManager.NbNotifications() > 0) { + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF)); lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); } else { - lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); } } diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.h b/src/displayapp/screens/WatchFacePineTimeStyle.h index 47a1dabf42..72537095f9 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.h +++ b/src/displayapp/screens/WatchFacePineTimeStyle.h @@ -61,7 +61,6 @@ namespace Pinetime { Utility::DirtyValue> currentDateTime {}; Utility::DirtyValue stepCount {}; Utility::DirtyValue notificationState {}; - Utility::DirtyValue notificationNbState {}; Utility::DirtyValue> currentWeather {}; static Pinetime::Controllers::Settings::Colors GetNext(Controllers::Settings::Colors color); From 09306cfb3f9b32bec184dd54c6b356694dcf5e82 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 27 Aug 2024 13:00:30 +0000 Subject: [PATCH 6/9] fix build --- src/displayapp/screens/WatchFacePineTimeStyle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index c3e9a3c72d..4e75637d4b 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -473,9 +473,9 @@ void WatchFacePineTimeStyle::Refresh() { notificationState = notificationManager.AreNewNotificationsAvailable(); if (notificationState.IsUpdated()) { if (notificationState.Get()) { - lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); - } else if (notificatioManager.NbNotifications() > 0) { + } else if (notificationManager.NbNotifications() > 0) { lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF)); lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); } else { From 3d59c850ea7903700920f39214ba152d4a7c90ec Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 27 Aug 2024 13:15:22 +0000 Subject: [PATCH 7/9] set notification icon color --- src/displayapp/screens/WatchFacePineTimeStyle.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index 4e75637d4b..6bb739dc8d 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -473,10 +473,12 @@ void WatchFacePineTimeStyle::Refresh() { notificationState = notificationManager.AreNewNotificationsAvailable(); if (notificationState.IsUpdated()) { if (notificationState.Get()) { - lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, + Convert(settingsController.GetPTSColorTime())); lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); } else if (notificationManager.NbNotifications() > 0) { - lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF)); + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, + Convert(settingsController.GetPTSColorTime()); lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); } else { lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); From 9202442a22268bfc913d66da741d6ff4031c331b Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 27 Aug 2024 13:26:32 +0000 Subject: [PATCH 8/9] add missing parentese --- src/displayapp/screens/WatchFacePineTimeStyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index 6bb739dc8d..e1ac62cf3b 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -478,7 +478,7 @@ void WatchFacePineTimeStyle::Refresh() { lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); } else if (notificationManager.NbNotifications() > 0) { lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, - Convert(settingsController.GetPTSColorTime()); + Convert(settingsController.GetPTSColorTime())); lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); } else { lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); From 5c58d27d1b76fae562bbbeabafa3f26cb0d09f80 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 27 Aug 2024 13:30:03 +0000 Subject: [PATCH 9/9] lint fix --- src/displayapp/screens/SystemInfo.cpp | 1 + src/displayapp/screens/WatchFacePineTimeStyle.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index dd39f88ab0..ad9e32542c 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -181,6 +181,7 @@ std::unique_ptr SystemInfo::CreateScreen2() { extern int mallocFailedCount; extern int stackOverflowCount; + std::unique_ptr SystemInfo::CreateScreen3() { lv_mem_monitor_t mon; lv_mem_monitor(&mon); diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index e1ac62cf3b..62cb182291 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -473,11 +473,15 @@ void WatchFacePineTimeStyle::Refresh() { notificationState = notificationManager.AreNewNotificationsAvailable(); if (notificationState.IsUpdated()) { if (notificationState.Get()) { - lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, + lv_obj_set_style_local_text_color(notificationIcon, + LV_LABEL_PART_MAIN, + LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); } else if (notificationManager.NbNotifications() > 0) { - lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, + lv_obj_set_style_local_text_color(notificationIcon, + LV_LABEL_PART_MAIN, + LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); } else {