Skip to content

Commit a7114f2

Browse files
committed
Fix display consistency with the HR measurement when measurements are already running when the app is open.
1 parent eb1209e commit a7114f2

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/displayapp/screens/HeartRate.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,23 @@ namespace {
2929

3030
HeartRate::HeartRate(Pinetime::Applications::DisplayApp *app, Controllers::HeartRateController& heartRateController, System::SystemTask &systemTask) :
3131
Screen(app), heartRateController{heartRateController}, systemTask{systemTask} {
32-
32+
bool isHrRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
3333
label_hr = lv_label_create(lv_scr_act(), nullptr);
3434

3535
lv_obj_set_style_local_text_font(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76);
36-
lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
36+
37+
if(isHrRunning)
38+
lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
39+
else
40+
lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
41+
3742
lv_label_set_text(label_hr, "000");
3843
lv_obj_align(label_hr, nullptr, LV_ALIGN_CENTER, 0, -40);
3944

4045
label_bpm = lv_label_create(lv_scr_act(), nullptr);
4146
lv_label_set_text(label_bpm, "Heart rate BPM");
4247
lv_obj_align(label_bpm, label_hr, LV_ALIGN_OUT_TOP_MID, 0, -20);
4348

44-
4549
label_status = lv_label_create(lv_scr_act(), nullptr);
4650
lv_obj_set_style_local_text_color(label_status, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x222222));
4751
lv_label_set_text(label_status, ToString(Pinetime::Controllers::HeartRateController::States::NotEnoughData));
@@ -55,7 +59,9 @@ HeartRate::HeartRate(Pinetime::Applications::DisplayApp *app, Controllers::Heart
5559
lv_obj_align(btn_startStop, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
5660

5761
label_startStop = lv_label_create(btn_startStop, nullptr);
58-
UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped);
62+
UpdateStartStopButton(isHrRunning);
63+
if(isHrRunning)
64+
systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping);
5965
}
6066

6167
HeartRate::~HeartRate() {

0 commit comments

Comments
 (0)