From 9aa0bc8ecf382245e3d874fed5cbc699921d05d4 Mon Sep 17 00:00:00 2001 From: adumelie Date: Thu, 14 Mar 2024 14:55:06 +0100 Subject: [PATCH 1/6] Fix and update documentation Fixed missing colon typo in template for minimal app example Updated reference to Apps enum after file move --- doc/code/Apps.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/code/Apps.md b/doc/code/Apps.md index b325fe98..1c8f8da1 100644 --- a/doc/code/Apps.md +++ b/doc/code/Apps.md @@ -140,7 +140,7 @@ namespace Pinetime { } template <> - struct AppTraits { + struct AppTraits { static constexpr Apps app = Apps::MyApp; static constexpr const char* icon = Screens::Symbol::myApp; static Screens::Screens* Create(AppController& controllers) { @@ -176,7 +176,7 @@ Now we have our very own app, but InfiniTime does not know about it yet. The first step is to include your `MyApp.cpp` (or any new cpp files for that matter) in the compilation by adding it to [CMakeLists.txt](/CMakeLists.txt). The next step to making it launch-able is to give your app an id. -To do this, add an entry in the enum class `Pinetime::Applications::Apps` ([displayapp/Apps.h](/src/displayapp/Apps.h)). +To do this, add an entry in the enum class `Pinetime::Applications::Apps` ([displayapp/apps/Apps.h](/src/displayapp/apps/Apps.h.in)). Name this entry after your app. Add `#include "displayapp/screens/MyApp.h"` to the file [displayapp/DisplayApp.cpp](/src/displayapp/DisplayApp.cpp). From 4c9d5332c70958d13c9b52ebcf3cf3af771422dd Mon Sep 17 00:00:00 2001 From: adumelie Date: Thu, 14 Mar 2024 16:38:08 +0100 Subject: [PATCH 2/6] Typo in code example --- doc/code/Apps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/code/Apps.md b/doc/code/Apps.md index 1c8f8da1..b0698b2b 100644 --- a/doc/code/Apps.md +++ b/doc/code/Apps.md @@ -143,7 +143,7 @@ namespace Pinetime { struct AppTraits { static constexpr Apps app = Apps::MyApp; static constexpr const char* icon = Screens::Symbol::myApp; - static Screens::Screens* Create(AppController& controllers) { + static Screens::Screen* Create(AppController& controllers) { return new Screens::MyApp(); } }; From ef384722782e66cae62a32c894e39f27ef28ca4a Mon Sep 17 00:00:00 2001 From: adumelie Date: Thu, 14 Mar 2024 16:39:36 +0100 Subject: [PATCH 3/6] More typos in code example --- doc/code/Apps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/code/Apps.md b/doc/code/Apps.md index b0698b2b..bf71eab4 100644 --- a/doc/code/Apps.md +++ b/doc/code/Apps.md @@ -142,7 +142,7 @@ namespace Pinetime { template <> struct AppTraits { static constexpr Apps app = Apps::MyApp; - static constexpr const char* icon = Screens::Symbol::myApp; + static constexpr const char* icon = Screens::Symbols::myApp; static Screens::Screen* Create(AppController& controllers) { return new Screens::MyApp(); } From 14c627090340de9748af3d971a18f7d218e8c6db Mon Sep 17 00:00:00 2001 From: adumelie Date: Thu, 14 Mar 2024 16:41:17 +0100 Subject: [PATCH 4/6] Typo in example code --- doc/code/Apps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/code/Apps.md b/doc/code/Apps.md index bf71eab4..44c4ed65 100644 --- a/doc/code/Apps.md +++ b/doc/code/Apps.md @@ -143,7 +143,7 @@ namespace Pinetime { struct AppTraits { static constexpr Apps app = Apps::MyApp; static constexpr const char* icon = Screens::Symbols::myApp; - static Screens::Screen* Create(AppController& controllers) { + static Screens::Screen* Create(AppControllers& controllers) { return new Screens::MyApp(); } }; From 7dbb8f54c6bb645ea72c6350dde87e29ad1d14b0 Mon Sep 17 00:00:00 2001 From: FintasticMan Date: Mon, 12 Feb 2024 13:01:22 +0100 Subject: [PATCH 5/6] chrono: Resolve TODOs related to C++20 chrono feats --- src/displayapp/screens/WatchFaceAnalog.cpp | 2 +- src/displayapp/screens/WatchFaceAnalog.h | 3 +-- src/displayapp/screens/WatchFaceCasioStyleG7710.cpp | 2 +- src/displayapp/screens/WatchFaceCasioStyleG7710.h | 3 +-- src/displayapp/screens/WatchFaceDigital.cpp | 2 +- src/displayapp/screens/WatchFaceDigital.h | 3 +-- src/displayapp/screens/WatchFaceInfineat.cpp | 2 +- src/displayapp/screens/WatchFaceInfineat.h | 3 +-- src/displayapp/screens/WatchFaceTerminal.cpp | 2 +- src/displayapp/screens/WatchFaceTerminal.h | 3 +-- 10 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index 2b27ad64..80a1c8b9 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -256,7 +256,7 @@ void WatchFaceAnalog::Refresh() { if (currentDateTime.IsUpdated()) { UpdateClock(); - currentDate = std::chrono::time_point_cast(currentDateTime.Get()); + currentDate = std::chrono::time_point_cast(currentDateTime.Get()); if (currentDate.IsUpdated()) { lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day()); } diff --git a/src/displayapp/screens/WatchFaceAnalog.h b/src/displayapp/screens/WatchFaceAnalog.h index 89ad4e13..2eee657e 100644 --- a/src/displayapp/screens/WatchFaceAnalog.h +++ b/src/displayapp/screens/WatchFaceAnalog.h @@ -43,8 +43,7 @@ namespace Pinetime { Utility::DirtyValue bleState {}; Utility::DirtyValue> currentDateTime; Utility::DirtyValue notificationState {false}; - using days = std::chrono::duration>; // TODO: days is standard in c++20 - Utility::DirtyValue> currentDate; + Utility::DirtyValue> currentDate; lv_obj_t* minor_scales; lv_obj_t* major_scales; diff --git a/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp b/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp index 72bfaaa3..c695f852 100644 --- a/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp +++ b/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp @@ -244,7 +244,7 @@ void WatchFaceCasioStyleG7710::Refresh() { } lv_obj_realign(label_time); - currentDate = std::chrono::time_point_cast(currentDateTime.Get()); + currentDate = std::chrono::time_point_cast(currentDateTime.Get()); if (currentDate.IsUpdated()) { const char* weekNumberFormat = "%V"; diff --git a/src/displayapp/screens/WatchFaceCasioStyleG7710.h b/src/displayapp/screens/WatchFaceCasioStyleG7710.h index f10e931c..0f46a692 100644 --- a/src/displayapp/screens/WatchFaceCasioStyleG7710.h +++ b/src/displayapp/screens/WatchFaceCasioStyleG7710.h @@ -51,8 +51,7 @@ namespace Pinetime { Utility::DirtyValue heartbeat {}; Utility::DirtyValue heartbeatRunning {}; Utility::DirtyValue notificationState {}; - using days = std::chrono::duration>; // TODO: days is standard in c++20 - Utility::DirtyValue> currentDate; + Utility::DirtyValue> currentDate; lv_point_t line_icons_points[3] {{0, 5}, {117, 5}, {122, 0}}; lv_point_t line_day_of_week_number_points[4] {{0, 0}, {100, 0}, {95, 95}, {0, 95}}; diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index afe00fa5..2e00ee98 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -125,7 +125,7 @@ void WatchFaceDigital::Refresh() { lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); } - currentDate = std::chrono::time_point_cast(currentDateTime.Get()); + currentDate = std::chrono::time_point_cast(currentDateTime.Get()); if (currentDate.IsUpdated()) { uint16_t year = dateTimeController.Year(); uint8_t day = dateTimeController.Day(); diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index 3ff78c8a..78232c1e 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -54,8 +54,7 @@ namespace Pinetime { Utility::DirtyValue notificationState {}; Utility::DirtyValue> currentWeather {}; - using days = std::chrono::duration>; // TODO: days is standard in c++20 - Utility::DirtyValue> currentDate; + Utility::DirtyValue> currentDate; lv_obj_t* label_time; lv_obj_t* label_time_ampm; diff --git a/src/displayapp/screens/WatchFaceInfineat.cpp b/src/displayapp/screens/WatchFaceInfineat.cpp index c643f3bd..4c6fc196 100644 --- a/src/displayapp/screens/WatchFaceInfineat.cpp +++ b/src/displayapp/screens/WatchFaceInfineat.cpp @@ -423,7 +423,7 @@ void WatchFaceInfineat::Refresh() { lv_obj_align(labelMinutes, timeContainer, LV_ALIGN_IN_BOTTOM_MID, 0, 0); } - currentDate = std::chrono::time_point_cast(currentDateTime.Get()); + currentDate = std::chrono::time_point_cast(currentDateTime.Get()); if (currentDate.IsUpdated()) { uint8_t day = dateTimeController.Day(); Controllers::DateTime::Days dayOfWeek = dateTimeController.DayOfWeek(); diff --git a/src/displayapp/screens/WatchFaceInfineat.h b/src/displayapp/screens/WatchFaceInfineat.h index 32c08f18..55c43f98 100644 --- a/src/displayapp/screens/WatchFaceInfineat.h +++ b/src/displayapp/screens/WatchFaceInfineat.h @@ -55,8 +55,7 @@ namespace Pinetime { Utility::DirtyValue> currentDateTime {}; Utility::DirtyValue stepCount {}; Utility::DirtyValue notificationState {}; - using days = std::chrono::duration>; // TODO: days is standard in c++20 - Utility::DirtyValue> currentDate; + Utility::DirtyValue> currentDate; // Lines making up the side cover lv_obj_t* lineBattery; diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp index 72383729..96d77741 100644 --- a/src/displayapp/screens/WatchFaceTerminal.cpp +++ b/src/displayapp/screens/WatchFaceTerminal.cpp @@ -125,7 +125,7 @@ void WatchFaceTerminal::Refresh() { lv_label_set_text_fmt(label_time, "[TIME]#11cc55 %02d:%02d:%02d", hour, minute, second); } - currentDate = std::chrono::time_point_cast(currentDateTime.Get()); + currentDate = std::chrono::time_point_cast(currentDateTime.Get()); if (currentDate.IsUpdated()) { uint16_t year = dateTimeController.Year(); Controllers::DateTime::Months month = dateTimeController.Month(); diff --git a/src/displayapp/screens/WatchFaceTerminal.h b/src/displayapp/screens/WatchFaceTerminal.h index ce22005f..bf460866 100644 --- a/src/displayapp/screens/WatchFaceTerminal.h +++ b/src/displayapp/screens/WatchFaceTerminal.h @@ -45,8 +45,7 @@ namespace Pinetime { Utility::DirtyValue heartbeat {}; Utility::DirtyValue heartbeatRunning {}; Utility::DirtyValue notificationState {}; - using days = std::chrono::duration>; // TODO: days is standard in c++20 - Utility::DirtyValue> currentDate; + Utility::DirtyValue> currentDate; lv_obj_t* label_time; lv_obj_t* label_date; From 4ca211289004f6270b69c2fab88d1143f3e7dc3d Mon Sep 17 00:00:00 2001 From: JF Date: Fri, 15 Mar 2024 09:20:19 +0100 Subject: [PATCH 6/6] Emit the message BleRadioEnableToggle to DisplayApp only if the enable state of the radio has actually changed. (#2037) This fixes an issue where the BLE connected logo would disappear when opening and closing the BLE setting (without changing it) while InfiniTime was already connected to a companion app. Co-authored-by: JustScott --- src/displayapp/screens/settings/SettingBluetooth.cpp | 6 +++--- src/displayapp/screens/settings/SettingBluetooth.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/displayapp/screens/settings/SettingBluetooth.cpp b/src/displayapp/screens/settings/SettingBluetooth.cpp index 82c3dee1..e4dc695c 100644 --- a/src/displayapp/screens/settings/SettingBluetooth.cpp +++ b/src/displayapp/screens/settings/SettingBluetooth.cpp @@ -36,17 +36,19 @@ namespace { SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) : app {app}, + settings {settingsController}, checkboxList( 0, 1, "Bluetooth", Symbols::bluetooth, settingsController.GetBleRadioEnabled() ? 0 : 1, - [&settings = settingsController](uint32_t index) { + [this](uint32_t index) { const bool priorMode = settings.GetBleRadioEnabled(); const bool newMode = options[index].radioEnabled; if (newMode != priorMode) { settings.SetBleRadioEnabled(newMode); + this->app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle); } }, CreateOptionArray()) { @@ -54,6 +56,4 @@ SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pine SettingBluetooth::~SettingBluetooth() { lv_obj_clean(lv_scr_act()); - // Pushing the message in the OnValueChanged function causes a freeze? - app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle); } diff --git a/src/displayapp/screens/settings/SettingBluetooth.h b/src/displayapp/screens/settings/SettingBluetooth.h index 1e3f9b81..0cf014f5 100644 --- a/src/displayapp/screens/settings/SettingBluetooth.h +++ b/src/displayapp/screens/settings/SettingBluetooth.h @@ -20,6 +20,7 @@ namespace Pinetime { private: DisplayApp* app; + Pinetime::Controllers::Settings& settings; CheckboxList checkboxList; }; }