summaryrefslogtreecommitdiff
path: root/src/displayapp/screens
diff options
context:
space:
mode:
authorRiku Isokoski <riksu9000@gmail.com>2022-02-20 15:06:28 +0200
committerJF <JF002@users.noreply.github.com>2022-03-03 21:10:39 +0100
commitf1c91e1ce0fb666449e751fc4a8216f1a672f95f (patch)
tree82a2c2f3f4a16be8c13357dd6431c5145faf8de1 /src/displayapp/screens
parent1bfee61ef9f136b186199fb41abf04bf63918574 (diff)
terminal watchface: remove icons and other fixes
Diffstat (limited to 'src/displayapp/screens')
-rw-r--r--src/displayapp/screens/WatchFaceTerminal.cpp38
-rw-r--r--src/displayapp/screens/WatchFaceTerminal.h2
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;