summaryrefslogtreecommitdiff
path: root/src/displayapp
diff options
context:
space:
mode:
authoravery <aveeryy@protonmail.com>2022-03-06 13:11:26 +0100
committerGitHub <noreply@github.com>2022-03-06 13:11:26 +0100
commit452dd12effae76f9d436404376e21ae34881be7a (patch)
tree1ee8dc073f49416885d95883c74d01be6d1cb4d3 /src/displayapp
parent5d974434ef2211c8feb7fe464bc9e2da3a3e1771 (diff)
parent30797b37bc509b24c86364f6d7b55be642a6dfb4 (diff)
Merge branch 'develop' into notifications-as-text
Diffstat (limited to 'src/displayapp')
-rw-r--r--src/displayapp/fonts/README.md16
-rw-r--r--src/displayapp/fonts/jetbrains_mono_bold_20.c4
-rw-r--r--src/displayapp/screens/HeartRate.h1
-rw-r--r--src/displayapp/screens/Motion.h1
-rw-r--r--src/displayapp/screens/Notifications.cpp19
-rw-r--r--src/displayapp/screens/Notifications.h4
-rw-r--r--src/displayapp/screens/WatchFaceAnalog.cpp1
-rw-r--r--src/displayapp/screens/WatchFaceDigital.cpp1
-rw-r--r--src/displayapp/screens/WatchFaceTerminal.cpp32
-rw-r--r--src/displayapp/screens/WatchFaceTerminal.h2
-rw-r--r--src/displayapp/screens/settings/Settings.cpp2
11 files changed, 37 insertions, 46 deletions
diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md
index 40ecd3e2..b4737681 100644
--- a/src/displayapp/fonts/README.md
+++ b/src/displayapp/fonts/README.md
@@ -31,6 +31,22 @@ Add new symbols:
static constexpr const char* newSymbol = "\xEF\x86\x85";
```
+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,
+ 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.
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" */
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 <cstdint>
#include <chrono>
#include "displayapp/screens/Screen.h"
-#include <bits/unique_ptr.h>
#include "systemtask/SystemTask.h"
#include <lvgl/src/lv_core/lv_style.h>
#include <lvgl/src/lv_core/lv_obj.h>
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 <cstdint>
#include <chrono>
#include "displayapp/screens/Screen.h"
-#include <bits/unique_ptr.h>
#include <lvgl/src/lv_core/lv_style.h>
#include <lvgl/src/lv_core/lv_obj.h>
#include <components/motion/MotionController.h>
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;
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);
diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp
index d1d22305..e77d594b 100644
--- a/src/displayapp/screens/WatchFaceTerminal.cpp
+++ b/src/displayapp/screens/WatchFaceTerminal.cpp
@@ -32,14 +32,6 @@ 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);
@@ -58,11 +50,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);
@@ -73,16 +65,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);
@@ -96,20 +86,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();
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;
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<Screen> 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<Screens::List>(2, 4, app, settingsController, applications);