diff options
Diffstat (limited to 'src/displayapp/screens/Tile.cpp')
-rw-r--r-- | src/displayapp/screens/Tile.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp index cfbe44d3..0a113e3e 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) { |