summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2021-04-18 13:50:38 +0200
committerJean-François Milants <jf@codingfield.com>2021-04-18 13:50:38 +0200
commita7114f21b7d1f8ae29e0e005757b42882917ac3d (patch)
tree0c204360d2b8e8f6c138bcd846a791f519f88de2 /src
parenteb1209e63825e038ef9fd1093088c29574f5215d (diff)
Fix display consistency with the HR measurement when measurements are already running when the app is open.
Diffstat (limited to 'src')
-rw-r--r--src/displayapp/screens/HeartRate.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/displayapp/screens/HeartRate.cpp b/src/displayapp/screens/HeartRate.cpp
index 0bc3c352..e735c18d 100644
--- a/src/displayapp/screens/HeartRate.cpp
+++ b/src/displayapp/screens/HeartRate.cpp
@@ -29,11 +29,16 @@ namespace {
HeartRate::HeartRate(Pinetime::Applications::DisplayApp *app, Controllers::HeartRateController& heartRateController, System::SystemTask &systemTask) :
Screen(app), heartRateController{heartRateController}, systemTask{systemTask} {
-
+ bool isHrRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
label_hr = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76);
- lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
+
+ if(isHrRunning)
+ lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
+ else
+ lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
+
lv_label_set_text(label_hr, "000");
lv_obj_align(label_hr, nullptr, LV_ALIGN_CENTER, 0, -40);
@@ -41,7 +46,6 @@ HeartRate::HeartRate(Pinetime::Applications::DisplayApp *app, Controllers::Heart
lv_label_set_text(label_bpm, "Heart rate BPM");
lv_obj_align(label_bpm, label_hr, LV_ALIGN_OUT_TOP_MID, 0, -20);
-
label_status = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(label_status, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x222222));
lv_label_set_text(label_status, ToString(Pinetime::Controllers::HeartRateController::States::NotEnoughData));
@@ -55,7 +59,9 @@ HeartRate::HeartRate(Pinetime::Applications::DisplayApp *app, Controllers::Heart
lv_obj_align(btn_startStop, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
label_startStop = lv_label_create(btn_startStop, nullptr);
- UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped);
+ UpdateStartStopButton(isHrRunning);
+ if(isHrRunning)
+ systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping);
}
HeartRate::~HeartRate() {