Skip to content

Commit f1c91e1

Browse files
Riksu9000JF002
authored andcommitted
terminal watchface: remove icons and other fixes
1 parent 1bfee61 commit f1c91e1

2 files changed

Lines changed: 9 additions & 31 deletions

File tree

src/displayapp/screens/WatchFaceTerminal.cpp

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,15 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app,
3232
motionController {motionController} {
3333
settingsController.SetClockFace(3);
3434

35-
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
36-
lv_label_set_text(batteryIcon, Symbols::batteryFull);
37-
lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, 2);
38-
39-
batteryPlug = lv_label_create(lv_scr_act(), nullptr);
40-
lv_label_set_text(batteryPlug, Symbols::plug);
41-
lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0);
42-
4335
batteryValue = lv_label_create(lv_scr_act(), nullptr);
4436
lv_label_set_recolor(batteryValue, true);
4537
lv_obj_align(batteryValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -20);
4638

4739
connectState = lv_label_create(lv_scr_act(), nullptr);
4840
lv_label_set_recolor(connectState, true);
49-
lv_label_set_text(connectState, "[STAT]#387b54 Disconnected#");
5041
lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40);
5142

5243
notificationIcon = lv_label_create(lv_scr_act(), nullptr);
53-
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
5444
lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 10, 0);
5545

5646
label_date = lv_label_create(lv_scr_act(), nullptr);
@@ -59,11 +49,11 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app,
5949

6050
label_prompt_1 = lv_label_create(lv_scr_act(), nullptr);
6151
lv_obj_align(label_prompt_1, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -80);
62-
lv_label_set_text(label_prompt_1, "user@watch:~ $ now");
52+
lv_label_set_text_static(label_prompt_1, "user@watch:~ $ now");
6353

6454
label_prompt_2 = lv_label_create(lv_scr_act(), nullptr);
6555
lv_obj_align(label_prompt_2, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);
66-
lv_label_set_text(label_prompt_2, "user@watch:~ $");
56+
lv_label_set_text_static(label_prompt_2, "user@watch:~ $");
6757

6858
label_time = lv_label_create(lv_scr_act(), nullptr);
6959
lv_label_set_recolor(label_time, true);
@@ -74,16 +64,14 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app,
7464
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
7565
lv_obj_set_size(backgroundLabel, 240, 240);
7666
lv_obj_set_pos(backgroundLabel, 0, 0);
77-
lv_label_set_text(backgroundLabel, "");
67+
lv_label_set_text_static(backgroundLabel, "");
7868

7969
heartbeatValue = lv_label_create(lv_scr_act(), nullptr);
8070
lv_label_set_recolor(heartbeatValue, true);
81-
lv_label_set_text(heartbeatValue, "[L_HR]#ee3311 0 bpm#");
8271
lv_obj_align(heartbeatValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 20);
8372

8473
stepValue = lv_label_create(lv_scr_act(), nullptr);
8574
lv_label_set_recolor(stepValue, true);
86-
lv_label_set_text(stepValue, "[STEP]#ee3377 0 steps#");
8775
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0);
8876

8977
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
@@ -97,20 +85,12 @@ WatchFaceTerminal::~WatchFaceTerminal() {
9785

9886
void WatchFaceTerminal::Refresh() {
9987
powerPresent = batteryController.IsPowerPresent();
100-
if (powerPresent.IsUpdated()) {
101-
lv_label_set_text_static(batteryPlug, BatteryIcon::GetPlugIcon(powerPresent.Get()));
102-
}
103-
10488
batteryPercentRemaining = batteryController.PercentRemaining();
105-
if (batteryPercentRemaining.IsUpdated()) {
106-
auto batteryPercent = batteryPercentRemaining.Get();
107-
if (batteryPercent == 100) {
108-
lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
109-
} else {
110-
lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
89+
if (batteryPercentRemaining.IsUpdated() || powerPresent.IsUpdated()) {
90+
lv_label_set_text_fmt(batteryValue, "[BATT]#387b54 %d%%", batteryPercentRemaining.Get());
91+
if (batteryController.IsPowerPresent()) {
92+
lv_label_ins_text(batteryValue, LV_LABEL_POS_LAST, " Charging");
11193
}
112-
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
113-
lv_label_set_text_fmt(batteryValue, "[BATT]#387b54 %d%\%#", batteryPercent);
11494
}
11595

11696
bleState = bleController.IsConnected();
@@ -130,9 +110,9 @@ void WatchFaceTerminal::Refresh() {
130110
notificationState = notificatioManager.AreNewNotificationsAvailable();
131111
if (notificationState.IsUpdated()) {
132112
if (notificationState.Get()) {
133-
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true));
113+
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(true));
134114
} else {
135-
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
115+
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false));
136116
}
137117
}
138118

src/displayapp/screens/WatchFaceTerminal.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ namespace Pinetime {
6060
lv_obj_t* label_prompt_1;
6161
lv_obj_t* label_prompt_2;
6262
lv_obj_t* backgroundLabel;
63-
lv_obj_t* batteryIcon;
64-
lv_obj_t* batteryPlug;
6563
lv_obj_t* batteryValue;
6664
lv_obj_t* heartbeatValue;
6765
lv_obj_t* stepValue;

0 commit comments

Comments
 (0)