Skip to content

Commit 452dd12

Browse files
authored
Merge branch 'develop' into notifications-as-text
2 parents 5d97443 + 30797b3 commit 452dd12

13 files changed

Lines changed: 40 additions & 48 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Fast open-source firmware for the [PineTime smartwatch](https://www.pine64.org/p
1616
- [AmazFish](https://openrepos.net/content/piggz/amazfish/) (SailfishOS)
1717
- [Siglo](https://github.com/alexr4535/siglo) (Linux)
1818
- [InfiniLink](https://github.com/xan-m/InfiniLink) **[Experimental]** (iOS)
19+
- [ITD](https://gitea.arsenm.dev/Arsen6331/itd) (Linux)
1920

2021
## Development
2122

src/components/settings/Settings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void Settings::LoadSettingsFromFile() {
2626
SettingsData bufferSettings;
2727
lfs_file_t settingsFile;
2828

29-
if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_RDWR | LFS_O_CREAT) != LFS_ERR_OK) {
29+
if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_RDONLY) != LFS_ERR_OK) {
3030
return;
3131
}
3232
fs.FileRead(&settingsFile, reinterpret_cast<uint8_t*>(&bufferSettings), sizeof(settings));
@@ -39,7 +39,7 @@ void Settings::LoadSettingsFromFile() {
3939
void Settings::SaveSettingsToFile() {
4040
lfs_file_t settingsFile;
4141

42-
if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_RDWR | LFS_O_CREAT) != LFS_ERR_OK) {
42+
if ( fs.FileOpen(&settingsFile, "/settings.dat", LFS_O_WRONLY | LFS_O_CREAT) != LFS_ERR_OK) {
4343
return;
4444
}
4545
fs.FileWrite(&settingsFile, reinterpret_cast<uint8_t*>(&settings), sizeof(settings));

src/displayapp/fonts/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@ Add new symbols:
3131
static constexpr const char* newSymbol = "\xEF\x86\x85";
3232
```
3333

34+
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:
35+
36+
/* U+0030 "0" */
37+
0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f,
38+
0xdf, 0xf7, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f,
39+
0x8f, 0xc0,
40+
41+
with
42+
43+
/* U+0030 "0" */
44+
0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e,
45+
0xdf, 0xb7, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f,
46+
0x8f, 0xc0,
47+
48+
(there are two changes: 7f -> 7e and f7 -> b7)
49+
3450
## Simple method to generate a font
3551

3652
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.

src/displayapp/fonts/jetbrains_mono_bold_20.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
8888
0xe, 0x3, 0x80, 0xc0, 0x70, 0x18, 0xe, 0x0,
8989

9090
/* U+0030 "0" */
91-
0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f,
92-
0xdf, 0xf7, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f,
91+
0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e,
92+
0xdf, 0xb7, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f,
9393
0x8f, 0xc0,
9494

9595
/* U+0031 "1" */

src/displayapp/screens/HeartRate.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <cstdint>
44
#include <chrono>
55
#include "displayapp/screens/Screen.h"
6-
#include <bits/unique_ptr.h>
76
#include "systemtask/SystemTask.h"
87
#include <lvgl/src/lv_core/lv_style.h>
98
#include <lvgl/src/lv_core/lv_obj.h>

src/displayapp/screens/Motion.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <cstdint>
44
#include <chrono>
55
#include "displayapp/screens/Screen.h"
6-
#include <bits/unique_ptr.h>
76
#include <lvgl/src/lv_core/lv_style.h>
87
#include <lvgl/src/lv_core/lv_obj.h>
98
#include <components/motion/MotionController.h>

src/displayapp/screens/Notifications.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,18 @@ Notifications::NotificationItem::NotificationItem(const char* title,
198198

199199
lv_obj_t* alert_type = lv_label_create(lv_scr_act(), nullptr);
200200
lv_obj_set_style_local_text_color(alert_type, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x888888));
201-
if (title == nullptr)
202-
title = "Notification";
203-
char* pchar;
204-
pchar = strchr(title, '\n');
205-
while (pchar != nullptr) {
206-
*pchar = ' ';
207-
pchar = strchr(pchar + 1, '\n');
201+
if(title == nullptr) {
202+
lv_label_set_text_static(alert_type, "Notification");
203+
} else {
204+
// copy title to label and replace newlines with spaces
205+
lv_label_set_text(alert_type, title);
206+
char *pchar = strchr(lv_label_get_text(alert_type), '\n');
207+
while (pchar != nullptr) {
208+
*pchar = ' ';
209+
pchar = strchr(pchar + 1, '\n');
210+
}
211+
lv_label_refr_text(alert_type);
208212
}
209-
lv_label_set_text(alert_type, title);
210213
lv_label_set_long_mode(alert_type, LV_LABEL_LONG_SROLL_CIRC);
211214
lv_obj_set_width(alert_type, 180);
212215
lv_obj_align(alert_type, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 16);

src/displayapp/screens/Notifications.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ namespace Pinetime {
6262
};
6363

6464
private:
65-
struct NotificationData {
66-
const char* title;
67-
const char* text;
68-
};
6965
Pinetime::Controllers::NotificationManager& notificationManager;
7066
Pinetime::Controllers::AlertNotificationService& alertNotificationService;
7167
Pinetime::Controllers::MotorController& motorController;

src/displayapp/screens/WatchFaceAnalog.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app,
5757
bleController {bleController},
5858
notificationManager {notificationManager},
5959
settingsController {settingsController} {
60-
settingsController.SetClockFace(1);
6160

6261
sHour = 99;
6362
sMinute = 99;

src/displayapp/screens/WatchFaceDigital.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
3232
settingsController {settingsController},
3333
heartRateController {heartRateController},
3434
motionController {motionController} {
35-
settingsController.SetClockFace(0);
3635

3736
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
3837
lv_label_set_text_static(batteryIcon, Symbols::batteryFull);

0 commit comments

Comments
 (0)