|
|
|
@ -38,11 +38,7 @@ BatteryInfo::BatteryInfo(Pinetime::Applications::DisplayApp* app, Pinetime::Cont
|
|
|
|
|
|
|
|
|
|
percent = lv_label_create(lv_scr_act(), nullptr);
|
|
|
|
|
lv_obj_set_style_local_text_font(percent, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76);
|
|
|
|
|
if (batteryPercent >= 0) {
|
|
|
|
|
lv_label_set_text_fmt(percent, "%02i%%", batteryPercent);
|
|
|
|
|
} else {
|
|
|
|
|
lv_label_set_text(percent, "--%");
|
|
|
|
|
}
|
|
|
|
|
lv_label_set_align(percent, LV_LABEL_ALIGN_LEFT);
|
|
|
|
|
lv_obj_align(percent, nullptr, LV_ALIGN_CENTER, 0, -60);
|
|
|
|
|
|
|
|
|
@ -72,7 +68,6 @@ BatteryInfo::~BatteryInfo() {
|
|
|
|
|
void BatteryInfo::UpdateAnim() {
|
|
|
|
|
batteryPercent = batteryController.PercentRemaining();
|
|
|
|
|
|
|
|
|
|
if (batteryPercent >= 0) {
|
|
|
|
|
if (batteryController.IsCharging() and batteryPercent < 100) {
|
|
|
|
|
animation += 1;
|
|
|
|
|
if (animation >= 100) {
|
|
|
|
@ -89,7 +84,6 @@ void BatteryInfo::UpdateAnim() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lv_bar_set_value(charging_bar, animation, LV_ANIM_OFF);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BatteryInfo::UpdateScreen() {
|
|
|
|
@ -99,7 +93,6 @@ void BatteryInfo::UpdateScreen() {
|
|
|
|
|
batteryPercent = batteryController.PercentRemaining();
|
|
|
|
|
batteryVoltage = batteryController.Voltage();
|
|
|
|
|
|
|
|
|
|
if (batteryPercent >= 0) {
|
|
|
|
|
if (batteryController.IsCharging() and batteryPercent < 100) {
|
|
|
|
|
lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_RED);
|
|
|
|
|
lv_label_set_text_static(status, "Charging");
|
|
|
|
@ -116,11 +109,6 @@ void BatteryInfo::UpdateScreen() {
|
|
|
|
|
|
|
|
|
|
lv_label_set_text_fmt(percent, "%02i%%", batteryPercent);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
lv_label_set_text_static(status, "Reading Battery status");
|
|
|
|
|
lv_label_set_text(percent, "--%");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lv_obj_align(status, charging_bar, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);
|
|
|
|
|
lv_label_set_text_fmt(voltage, "%1i.%02i volts", batteryVoltage / 1000, batteryVoltage % 1000 / 10);
|
|
|
|
|
}
|
|
|
|
|