diff options
author | Riku Isokoski <riksu9000@gmail.com> | 2021-09-03 14:35:38 +0300 |
---|---|---|
committer | Riku Isokoski <riksu9000@gmail.com> | 2021-09-03 14:35:38 +0300 |
commit | fd52ca8fe6f42226ec32a001f4c61dc100ead94a (patch) | |
tree | 250d929d0c9bfb682e7884c907f284a785b2484f /src/displayapp/screens/WatchFaceDigital.cpp | |
parent | 6f9f0e8b0e42a5526d47ca664534fb6b0ccb6ace (diff) |
Detect full charge and improve watchface display
Diffstat (limited to 'src/displayapp/screens/WatchFaceDigital.cpp')
-rw-r--r-- | src/displayapp/screens/WatchFaceDigital.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 58ab6190..3e755f8e 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -102,12 +102,20 @@ WatchFaceDigital::~WatchFaceDigital() { } void WatchFaceDigital::Refresh() { + isCharging = batteryController.IsCharging(); + if (isCharging.IsUpdated()) { + lv_label_set_text(batteryPlug, BatteryIcon::GetPlugIcon(isCharging.Get())); + } + batteryPercentRemaining = batteryController.PercentRemaining(); if (batteryPercentRemaining.IsUpdated()) { auto batteryPercent = batteryPercentRemaining.Get(); + if (batteryPercent == 100) { + lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN); + } else { + lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + } lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); - auto isCharging = batteryController.IsCharging() or batteryController.IsPowerPresent(); - lv_label_set_text(batteryPlug, BatteryIcon::GetPlugIcon(isCharging)); } bleState = bleController.IsConnected(); |