From ab9eaef3fc7f1d6c0126cb22f547fd762c489cb3 Mon Sep 17 00:00:00 2001 From: Julian Foad Date: Mon, 26 Aug 2024 14:19:06 +0100 Subject: [PATCH] heart rate indicator: change '0' to '...' (Analog, Digital, Terminal) --- src/displayapp/screens/WatchFaceAnalog.cpp | 6 +++++- src/displayapp/screens/WatchFaceDigital.cpp | 6 +++++- src/displayapp/screens/WatchFaceTerminal.cpp | 8 ++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index 0fbd5482..0c440bd5 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -300,7 +300,11 @@ void WatchFaceAnalog::Refresh() { if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) { if (heartbeatRunning.Get()) { lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B)); - lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get()); + auto val = heartbeat.Get(); + if (val) + lv_label_set_text_fmt(heartbeatValue, "%d", val); + else + lv_label_set_text_static(heartbeatValue, "..."); } else { lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x1B1B1B)); lv_label_set_text_static(heartbeatValue, ""); diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 9e61285f..c9a4378d 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -162,7 +162,11 @@ void WatchFaceDigital::Refresh() { if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) { if (heartbeatRunning.Get()) { lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B)); - lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get()); + auto val = heartbeat.Get(); + if (val) + lv_label_set_text_fmt(heartbeatValue, "%d", val); + else + lv_label_set_text_static(heartbeatValue, "..."); } else { lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x1B1B1B)); lv_label_set_text_static(heartbeatValue, ""); diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp index 29b44490..14769241 100644 --- a/src/displayapp/screens/WatchFaceTerminal.cpp +++ b/src/displayapp/screens/WatchFaceTerminal.cpp @@ -146,9 +146,13 @@ void WatchFaceTerminal::Refresh() { heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped; if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) { if (heartbeatRunning.Get()) { - lv_label_set_text_fmt(heartbeatValue, R_LTGREY("puls=")"#ee3311 %d bpm#", heartbeat.Get()); + auto val = heartbeat.Get(); + if (val) + lv_label_set_text_fmt(heartbeatValue, R_LTGREY("puls=")"#ee3311 %d bpm#", val); + else + lv_label_set_text_static(heartbeatValue, R_LTGREY("puls=")"#ee3311 ...#"); } else { - lv_label_set_text_static(heartbeatValue, R_LTGREY("puls=")"#ee3311 ---#"); + lv_label_set_text_static(heartbeatValue, R_LTGREY("puls=---")); } }