Skip to content

Commit 65e4fe0

Browse files
authored
Merge pull request #314 from eivindm/improved_heartbeat_in_watchface
Improve design of heartbeat data in digital watchface
2 parents 242620b + 3355afb commit 65e4fe0

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

src/displayapp/screens/WatchFaceDigital.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,9 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
8888

8989
heartbeatValue = lv_label_create(lv_scr_act(), nullptr);
9090
lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B));
91-
lv_label_set_text(heartbeatValue, "---");
91+
lv_label_set_text(heartbeatValue, "");
9292
lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
9393

94-
heartbeatBpm = lv_label_create(lv_scr_act(), nullptr);
95-
lv_obj_set_style_local_text_color(heartbeatBpm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B));
96-
lv_label_set_text(heartbeatBpm, "BPM");
97-
lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
98-
9994
stepValue = lv_label_create(lv_scr_act(), nullptr);
10095
lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FFE7));
10196
lv_label_set_text(stepValue, "0");
@@ -226,14 +221,16 @@ bool WatchFaceDigital::Refresh() {
226221
heartbeat = heartRateController.HeartRate();
227222
heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
228223
if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
229-
if (heartbeatRunning.Get())
224+
if (heartbeatRunning.Get()) {
225+
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B));
230226
lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get());
231-
else
232-
lv_label_set_text_static(heartbeatValue, "---");
227+
} else {
228+
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x1B1B1B));
229+
lv_label_set_text_static(heartbeatValue, "");
230+
}
233231

234232
lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2);
235233
lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
236-
lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
237234
}
238235

239236
stepCount = motionController.NbSteps();

0 commit comments

Comments
 (0)