diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 1fbfc15a..df481806 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -23,6 +23,7 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController, : currentDateTime {{}}, dateTimeController {dateTimeController}, notificationManager {notificationManager}, + batteryController {batteryController}, settingsController {settingsController}, heartRateController {heartRateController}, motionController {motionController}, @@ -34,6 +35,11 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController, lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_LIME); lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0); + + + batteryValue = lv_label_create(lv_scr_act(), nullptr); + //lv_label_set_recolor(batteryValue, true); + lv_obj_align(batteryValue, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -3, -110); label_seconds = lv_label_create(lv_scr_act(), nullptr); // for secs lv_obj_align(label_seconds, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 0, -55); @@ -83,6 +89,11 @@ WatchFaceDigital::~WatchFaceDigital() { void WatchFaceDigital::Refresh() { statusIcons.Update(); + + batteryPercentRemaining = batteryController.PercentRemaining(); + if (batteryPercentRemaining.IsUpdated()) { + lv_label_set_text_fmt(batteryValue, "%d%%", batteryPercentRemaining.Get()); + } notificationState = notificationManager.AreNewNotificationsAvailable(); if (notificationState.IsUpdated()) { diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index 5b0ce672..4b66ae0b 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -55,6 +55,7 @@ namespace Pinetime { lv_obj_t* label_time; lv_obj_t* label_seconds; //for secs //lv_obj_t* label_time_ampm; + lv_obj_t* batteryValue; lv_obj_t* label_date; lv_obj_t* heartbeatIcon; lv_obj_t* heartbeatValue; @@ -63,6 +64,7 @@ namespace Pinetime { lv_obj_t* notificationIcon; Controllers::DateTime& dateTimeController; + const Controllers::Battery& batteryController; Controllers::NotificationManager& notificationManager; Controllers::Settings& settingsController; Controllers::HeartRateController& heartRateController;