From f77dbcd679cb9970ae8d4568ed58260e0c04d48a Mon Sep 17 00:00:00 2001 From: Michele Bini Date: Mon, 11 Apr 2022 05:19:30 +0200 Subject: Tweak heartrate display for digital and analog24 watchfaces 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, ""); -- cgit v0.10.2