summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/Tile.cpp
diff options
context:
space:
mode:
authorRiku Isokoski <riksu9000@gmail.com>2022-04-07 14:28:04 (GMT)
committerRiku Isokoski <riksu9000@gmail.com>2022-04-25 14:03:08 (GMT)
commitb31fbb4adb0f895ff32b93fff492070e44716d54 (patch)
tree337c1fe0065f7f20738804b74e824347e87bc207 /src/displayapp/screens/Tile.cpp
parent54df828665b135aa5e49a2e182bad59d2d705039 (diff)
New sharper batteryicon. Remove old unused batteryicons
Diffstat (limited to 'src/displayapp/screens/Tile.cpp')
-rw-r--r--src/displayapp/screens/Tile.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp
index cfbe44d..0a113e3 100644
--- a/src/displayapp/screens/Tile.cpp
+++ b/src/displayapp/screens/Tile.cpp
@@ -35,14 +35,12 @@ Tile::Tile(uint8_t screenID,
// Time
label_time = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text(label_time, dateTimeController.FormattedTime().c_str());
lv_label_set_align(label_time, LV_LABEL_ALIGN_CENTER);
lv_obj_align(label_time, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0);
// Battery
- batteryIcon = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
- lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, -8, 0);
+ batteryIcon.Create(lv_scr_act());
+ lv_obj_align(batteryIcon.GetObject(), nullptr, LV_ALIGN_IN_TOP_RIGHT, -8, 0);
if (numScreens > 1) {
pageIndicatorBasePoints[0].x = LV_HOR_RES - 1;
@@ -113,6 +111,8 @@ Tile::Tile(uint8_t screenID,
lv_label_set_text_static(backgroundLabel, "");
taskUpdate = lv_task_create(lv_update_task, 5000, LV_TASK_PRIO_MID, this);
+
+ UpdateScreen();
}
Tile::~Tile() {
@@ -122,7 +122,7 @@ Tile::~Tile() {
void Tile::UpdateScreen() {
lv_label_set_text(label_time, dateTimeController.FormattedTime().c_str());
- lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
+ batteryIcon.SetBatteryPercentage(batteryController.PercentRemaining());
}
void Tile::OnValueChangedEvent(lv_obj_t* obj, uint32_t buttonId) {