summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/WatchFaceDigital.cpp
diff options
context:
space:
mode:
authorRiku Isokoski <riksu9000@gmail.com>2022-04-07 14:28:04 (GMT)
committerMichele Bini <michele.bini@gmail.com>2022-06-06 05:32:21 (GMT)
commitfab003528965668e2855491b36b5ba553c6a52f5 (patch)
tree03cb04e9813b381ef7626970d549b58191f379d4 /src/displayapp/screens/WatchFaceDigital.cpp
parentfbfb8fa4a2ca9274c73f2ba2e6cec4b8fc9e8ad4 (diff)
New sharper batteryicon. Remove old unused batteryicons
Diffstat (limited to 'src/displayapp/screens/WatchFaceDigital.cpp')
-rw-r--r--src/displayapp/screens/WatchFaceDigital.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp
index 25e86fb..3209330 100644
--- a/src/displayapp/screens/WatchFaceDigital.cpp
+++ b/src/displayapp/screens/WatchFaceDigital.cpp
@@ -36,20 +36,19 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app,
heartRateController {heartRateController},
motionController {motionController} {
- batteryIcon = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(batteryIcon, Symbols::batteryFull);
- lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
+ batteryIcon.Create(lv_scr_act());
+ lv_obj_align(batteryIcon.GetObject(), nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
batteryPlug = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(batteryPlug, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFF0000));
lv_label_set_text_static(batteryPlug, Symbols::plug);
- lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, 0, 0);
+ lv_obj_align(batteryPlug, batteryIcon.GetObject(), LV_ALIGN_OUT_LEFT_MID, 0, 0);
batteryPercentLabel = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color( batteryPercentLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999));
lv_obj_set_style_local_text_font( batteryPercentLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont1);
lv_label_set_text_static( batteryPercentLabel, battery_percent_label_text);
- lv_obj_align( batteryPercentLabel, batteryIcon, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, 0);
+ lv_obj_align( batteryPercentLabel, batteryIcon.GetObject(), LV_ALIGN_OUT_BOTTOM_RIGHT, 0, 0);
lv_label_set_align( batteryPercentLabel, LV_LABEL_ALIGN_RIGHT);
batteryVoltageLabel = lv_label_create(lv_scr_act(), nullptr);
@@ -266,19 +265,13 @@ void WatchFaceDigital::Refresh() {
if (batteryPercentRemaining.IsUpdated()) {
batteryRefreshed = true;
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_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
+ batteryIcon.SetBatteryPercentage(batteryPercent);
}
bleState = bleController.IsConnected();
if (bleState.IsUpdated()) {
lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get()));
}
- lv_obj_realign(batteryIcon);
lv_obj_realign(batteryPlug);
lv_obj_realign(bleIcon);