Added battery percent to digital watch face
This commit is contained in:
parent
b95823e745
commit
cdd97b3871
@ -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()) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user