From 51640c72489109149c8a7c6c7cf044862cceabf5 Mon Sep 17 00:00:00 2001 From: Arsen6331 Date: Thu, 3 Mar 2022 17:01:34 +0000 Subject: [PATCH 01/11] Add ITD as a companion app --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ae315f24..524f510e 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Fast open-source firmware for the [PineTime smartwatch](https://www.pine64.org/p - [AmazFish](https://openrepos.net/content/piggz/amazfish/) (SailfishOS) - [Siglo](https://github.com/alexr4535/siglo) (Linux) - [InfiniLink](https://github.com/xan-m/InfiniLink) **[Experimental]** (iOS) + - [ITD](https://gitea.arsenm.dev/Arsen6331/itd) (Linux) ## Development From 29f0bce46bd531ffa83f3445c0e0d893217aa50d Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Mon, 21 Feb 2022 22:50:20 +0100 Subject: [PATCH 02/11] Remove unused includes in HearRate and Motion.h The include `bits/unique_ptr.h` isn't used, so remove it. --- src/displayapp/screens/HeartRate.h | 1 - src/displayapp/screens/Motion.h | 1 - 2 files changed, 2 deletions(-) diff --git a/src/displayapp/screens/HeartRate.h b/src/displayapp/screens/HeartRate.h index baa0ccdd..2ad00351 100644 --- a/src/displayapp/screens/HeartRate.h +++ b/src/displayapp/screens/HeartRate.h @@ -3,7 +3,6 @@ #include #include #include "displayapp/screens/Screen.h" -#include #include "systemtask/SystemTask.h" #include #include diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h index d6997409..4d2bd4f2 100644 --- a/src/displayapp/screens/Motion.h +++ b/src/displayapp/screens/Motion.h @@ -3,7 +3,6 @@ #include #include #include "displayapp/screens/Screen.h" -#include #include #include #include From a29e30c1876891e504ad62fb35d3b1be76b175a4 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Sat, 29 Jan 2022 23:30:03 +0100 Subject: [PATCH 03/11] Notifications: replace newlines in label-copy because of const char* title The variable `title` is defined as `const char*`, which means, that `strchr()` returns a `const char*` as well according to https://www.cplusplus.com/reference/cstring/strchr/ But in the same line the return value is assigned to a non-const `char*`, which shouldn't be allowed (error with `-pedantic`). Because the `lv_label` creates an internal copy of the title sting, just modify that one instead and replace newline in the copied string. --- src/displayapp/screens/Notifications.cpp | 19 +++++++++++-------- src/displayapp/screens/Notifications.h | 4 ---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 3a39dacf..f9afd8c7 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -198,15 +198,18 @@ Notifications::NotificationItem::NotificationItem(const char* title, lv_obj_t* alert_type = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(alert_type, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x888888)); - if (title == nullptr) - title = "Notification"; - char* pchar; - pchar = strchr(title, '\n'); - while (pchar != nullptr) { - *pchar = ' '; - pchar = strchr(pchar + 1, '\n'); + if(title == nullptr) { + lv_label_set_text_static(alert_type, "Notification"); + } else { + // copy title to label and replace newlines with spaces + lv_label_set_text(alert_type, title); + char *pchar = strchr(lv_label_get_text(alert_type), '\n'); + while (pchar != nullptr) { + *pchar = ' '; + pchar = strchr(pchar + 1, '\n'); + } + lv_label_refr_text(alert_type); } - lv_label_set_text(alert_type, title); lv_label_set_long_mode(alert_type, LV_LABEL_LONG_SROLL_CIRC); lv_obj_set_width(alert_type, 180); lv_obj_align(alert_type, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 16); diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h index f49d3b3a..74160356 100644 --- a/src/displayapp/screens/Notifications.h +++ b/src/displayapp/screens/Notifications.h @@ -62,10 +62,6 @@ namespace Pinetime { }; private: - struct NotificationData { - const char* title; - const char* text; - }; Pinetime::Controllers::NotificationManager& notificationManager; Pinetime::Controllers::AlertNotificationService& alertNotificationService; Pinetime::Controllers::MotorController& motorController; From 1bfee61ef9f136b186199fb41abf04bf63918574 Mon Sep 17 00:00:00 2001 From: avery Date: Tue, 22 Feb 2022 17:37:28 +0100 Subject: [PATCH 04/11] Replace Airplane mode icon --- src/displayapp/screens/settings/Settings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index 981b4973..dce0c071 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -64,7 +64,7 @@ std::unique_ptr Settings::CreateScreen3() { {Symbols::clock, "Chimes", Apps::SettingChimes}, {Symbols::tachometer, "Shake Calib.", Apps::SettingShakeThreshold}, {Symbols::check, "Firmware", Apps::FirmwareValidation}, - {Symbols::list, "Airplane mode", Apps::SettingAirplaneMode} + {Symbols::airplane, "Airplane mode", Apps::SettingAirplaneMode} }}; return std::make_unique(2, 4, app, settingsController, applications); From f1c91e1ce0fb666449e751fc4a8216f1a672f95f Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sun, 20 Feb 2022 15:06:28 +0200 Subject: [PATCH 05/11] terminal watchface: remove icons and other fixes --- src/displayapp/screens/WatchFaceTerminal.cpp | 38 +++++--------------- src/displayapp/screens/WatchFaceTerminal.h | 2 -- 2 files changed, 9 insertions(+), 31 deletions(-) diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp index ccfbdd0b..08a9db5b 100644 --- a/src/displayapp/screens/WatchFaceTerminal.cpp +++ b/src/displayapp/screens/WatchFaceTerminal.cpp @@ -32,25 +32,15 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, motionController {motionController} { settingsController.SetClockFace(3); - batteryIcon = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(batteryIcon, Symbols::batteryFull); - lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, 2); - - batteryPlug = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(batteryPlug, Symbols::plug); - lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); - batteryValue = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(batteryValue, true); lv_obj_align(batteryValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -20); connectState = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(connectState, true); - lv_label_set_text(connectState, "[STAT]#387b54 Disconnected#"); lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40); notificationIcon = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 10, 0); label_date = lv_label_create(lv_scr_act(), nullptr); @@ -59,11 +49,11 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, label_prompt_1 = lv_label_create(lv_scr_act(), nullptr); lv_obj_align(label_prompt_1, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -80); - lv_label_set_text(label_prompt_1, "user@watch:~ $ now"); + lv_label_set_text_static(label_prompt_1, "user@watch:~ $ now"); label_prompt_2 = lv_label_create(lv_scr_act(), nullptr); lv_obj_align(label_prompt_2, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60); - lv_label_set_text(label_prompt_2, "user@watch:~ $"); + lv_label_set_text_static(label_prompt_2, "user@watch:~ $"); label_time = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(label_time, true); @@ -74,16 +64,14 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text(backgroundLabel, ""); + lv_label_set_text_static(backgroundLabel, ""); heartbeatValue = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(heartbeatValue, true); - lv_label_set_text(heartbeatValue, "[L_HR]#ee3311 0 bpm#"); lv_obj_align(heartbeatValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 20); stepValue = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(stepValue, true); - lv_label_set_text(stepValue, "[STEP]#ee3377 0 steps#"); lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0); taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); @@ -97,20 +85,12 @@ WatchFaceTerminal::~WatchFaceTerminal() { void WatchFaceTerminal::Refresh() { powerPresent = batteryController.IsPowerPresent(); - if (powerPresent.IsUpdated()) { - lv_label_set_text_static(batteryPlug, BatteryIcon::GetPlugIcon(powerPresent.Get())); - } - batteryPercentRemaining = batteryController.PercentRemaining(); - if (batteryPercentRemaining.IsUpdated()) { - auto batteryPercent = batteryPercentRemaining.Get(); - if (batteryPercent == 100) { - lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN); - } else { - lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + if (batteryPercentRemaining.IsUpdated() || powerPresent.IsUpdated()) { + lv_label_set_text_fmt(batteryValue, "[BATT]#387b54 %d%%", batteryPercentRemaining.Get()); + if (batteryController.IsPowerPresent()) { + lv_label_ins_text(batteryValue, LV_LABEL_POS_LAST, " Charging"); } - lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); - lv_label_set_text_fmt(batteryValue, "[BATT]#387b54 %d%\%#", batteryPercent); } bleState = bleController.IsConnected(); @@ -130,9 +110,9 @@ void WatchFaceTerminal::Refresh() { notificationState = notificatioManager.AreNewNotificationsAvailable(); if (notificationState.IsUpdated()) { if (notificationState.Get()) { - lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true)); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true)); } else { - lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); } } diff --git a/src/displayapp/screens/WatchFaceTerminal.h b/src/displayapp/screens/WatchFaceTerminal.h index 78c7b8aa..d236da34 100644 --- a/src/displayapp/screens/WatchFaceTerminal.h +++ b/src/displayapp/screens/WatchFaceTerminal.h @@ -60,8 +60,6 @@ namespace Pinetime { lv_obj_t* label_prompt_1; lv_obj_t* label_prompt_2; lv_obj_t* backgroundLabel; - lv_obj_t* batteryIcon; - lv_obj_t* batteryPlug; lv_obj_t* batteryValue; lv_obj_t* heartbeatValue; lv_obj_t* stepValue; From 1eaf258a633969abdd0e41fbcac9e17fe38eb409 Mon Sep 17 00:00:00 2001 From: medeyko Date: Mon, 7 Feb 2022 17:17:12 +0300 Subject: [PATCH 06/11] Update jetbrains_mono_bold_20.c Fix 0 (zero) symbol. For more details, #988 --- src/displayapp/fonts/jetbrains_mono_bold_20.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/displayapp/fonts/jetbrains_mono_bold_20.c b/src/displayapp/fonts/jetbrains_mono_bold_20.c index 944e47a1..6cd7aead 100644 --- a/src/displayapp/fonts/jetbrains_mono_bold_20.c +++ b/src/displayapp/fonts/jetbrains_mono_bold_20.c @@ -88,8 +88,8 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { 0xe, 0x3, 0x80, 0xc0, 0x70, 0x18, 0xe, 0x0, /* U+0030 "0" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f, - 0xdf, 0xf7, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0xdf, 0xb7, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, 0x8f, 0xc0, /* U+0031 "1" */ From 43399b3832df7375f9139d7bd3c082a49549c616 Mon Sep 17 00:00:00 2001 From: medeyko Date: Mon, 7 Feb 2022 17:25:56 +0300 Subject: [PATCH 07/11] Update README.md --- src/displayapp/fonts/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md index 40ecd3e2..5007060e 100644 --- a/src/displayapp/fonts/README.md +++ b/src/displayapp/fonts/README.md @@ -31,6 +31,23 @@ Add new symbols: static constexpr const char* newSymbol = "\xEF\x86\x85"; ``` +#### Fix the zero symbol +If you don't wish the inner dot of the 0 (zero) symbol to stick to the boundary), edit `src/displayapp/fonts/jetbrains_mono_bold_20.c` and replace: + + /* U+0030 "0" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f, + 0xdf, 0xf7, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x8f, 0xc0, + +with + + /* U+0030 "0" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0xdf, 0xb7, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x8f, 0xc0, + +(there are two changes: 7f -> 7e and f7 -> b7) + ## Simple method to generate a font If you want to generate a basic font containing only numbers and letters, you can use the above settings but instead of specifying a range, simply list the characters you need in the Symbols field and leave the range blank. This is the approach used for the PineTimeStyle watchface. From dd28359571088cc850d315b5c3689c69f54e5838 Mon Sep 17 00:00:00 2001 From: medeyko Date: Mon, 7 Feb 2022 17:31:18 +0300 Subject: [PATCH 08/11] Update README.md remove unnecessary ) --- src/displayapp/fonts/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md index 5007060e..a5f66b10 100644 --- a/src/displayapp/fonts/README.md +++ b/src/displayapp/fonts/README.md @@ -32,7 +32,7 @@ static constexpr const char* newSymbol = "\xEF\x86\x85"; ``` #### Fix the zero symbol -If you don't wish the inner dot of the 0 (zero) symbol to stick to the boundary), edit `src/displayapp/fonts/jetbrains_mono_bold_20.c` and replace: +If you don't wish the inner dot of the 0 (zero) symbol to stick to the boundary, edit `src/displayapp/fonts/jetbrains_mono_bold_20.c` and replace: /* U+0030 "0" */ 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f, From dd47ba9782cb7a7a2268da5b493e6d385bdf08af Mon Sep 17 00:00:00 2001 From: medeyko Date: Mon, 7 Feb 2022 18:29:28 +0300 Subject: [PATCH 09/11] Update README.md More imperative tone --- src/displayapp/fonts/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md index a5f66b10..b4737681 100644 --- a/src/displayapp/fonts/README.md +++ b/src/displayapp/fonts/README.md @@ -31,8 +31,7 @@ Add new symbols: static constexpr const char* newSymbol = "\xEF\x86\x85"; ``` -#### Fix the zero symbol -If you don't wish the inner dot of the 0 (zero) symbol to stick to the boundary, edit `src/displayapp/fonts/jetbrains_mono_bold_20.c` and replace: +Then fix an error that happens during the font conversion (the inner dot of the 'zero' symbol sticks to the boundary): edit `src/displayapp/fonts/jetbrains_mono_bold_20.c` and replace: /* U+0030 "0" */ 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f, From 5613449bfb16ed7bac672621f0f6c13afb1e1718 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Fri, 19 Nov 2021 23:14:19 +0100 Subject: [PATCH 10/11] Settings: more specific read and write mode For each filesystem interaction be more specific if we want to read from the file or write to it. Doing a non-creating read on the loading of the settings file, otherwise an empty file could be created, and when reading that empty file for the initial settings I would expect an error (or random data) when reading. --- src/components/settings/Settings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/settings/Settings.cpp b/src/components/settings/Settings.cpp index ef73ad1c..fee62daf 100644 --- a/src/components/settings/Settings.cpp +++ b/src/components/settings/Settings.cpp @@ -26,7 +26,7 @@ void Settings::LoadSettingsFromFile() { SettingsData bufferSettings; lfs_file_t settingsFile; - if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_RDWR | LFS_O_CREAT) != LFS_ERR_OK) { + if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_RDONLY) != LFS_ERR_OK) { return; } fs.FileRead(&settingsFile, reinterpret_cast(&bufferSettings), sizeof(settings)); @@ -39,7 +39,7 @@ void Settings::LoadSettingsFromFile() { void Settings::SaveSettingsToFile() { lfs_file_t settingsFile; - if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_RDWR | LFS_O_CREAT) != LFS_ERR_OK) { + if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_WRONLY | LFS_O_CREAT) != LFS_ERR_OK) { return; } fs.FileWrite(&settingsFile, reinterpret_cast(&settings), sizeof(settings)); From 30797b37bc509b24c86364f6d7b55be642a6dfb4 Mon Sep 17 00:00:00 2001 From: Yehoshua Pesach Wallach Date: Fri, 28 Jan 2022 14:34:59 +0200 Subject: [PATCH 11/11] removed SetClockFace from watchface Constructors --- src/displayapp/screens/WatchFaceAnalog.cpp | 1 - src/displayapp/screens/WatchFaceDigital.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index f027a744..f1b91444 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -57,7 +57,6 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app, bleController {bleController}, notificationManager {notificationManager}, settingsController {settingsController} { - settingsController.SetClockFace(1); sHour = 99; sMinute = 99; diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 56155d52..59bde839 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -32,7 +32,6 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app, settingsController {settingsController}, heartRateController {heartRateController}, motionController {motionController} { - settingsController.SetClockFace(0); batteryIcon = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text_static(batteryIcon, Symbols::batteryFull);