diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-04-11 03:19:30 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-04-11 03:20:49 (GMT) |
| commit | f77dbcd679cb9970ae8d4568ed58260e0c04d48a (patch) | |
| tree | 33b964d06c880ceafd9fe609b0678a014974d578 | |
| parent | 19d20bb847fc1a670b9939f9c173af84eb04ca13 (diff) | |
Tweak heartrate display for digital and analog24 watchfaces
| -rw-r--r-- | src/displayapp/screens/WatchFaceAnalog24.cpp | 7 | ||||
| -rw-r--r-- | src/displayapp/screens/WatchFaceDigital.cpp | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/displayapp/screens/WatchFaceAnalog24.cpp b/src/displayapp/screens/WatchFaceAnalog24.cpp index 875c0f1..5e37e7b 100644 --- a/src/displayapp/screens/WatchFaceAnalog24.cpp +++ b/src/displayapp/screens/WatchFaceAnalog24.cpp @@ -241,7 +241,12 @@ void WatchFaceAnalog24::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(0x770505)); - lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get()); + auto v = heartbeat.Get(); + if (v != 0) { + lv_label_set_text_fmt(heartbeatValue, "%d", v); + } 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(0x111111)); lv_label_set_text_static(heartbeatValue, ""); diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index fa81418..76283e2 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -262,7 +262,12 @@ 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 v = heartbeat.Get(); + if (v) { + lv_label_set_text_fmt(heartbeatValue, "%d", v); + } 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, ""); |
