Modify status text in BatteryInfo so it fits on screen (#437)

* Modify status text in BatteryInfo so it fits on screen
This commit is contained in:
kieranc 2021-07-11 17:48:16 +02:00 committed by GitHub
parent 6a91b83b12
commit 748e31421d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -102,16 +102,16 @@ void BatteryInfo::UpdateScreen() {
if (batteryPercent >= 0) { if (batteryPercent >= 0) {
if (batteryController.IsCharging() and batteryPercent < 100) { 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_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_RED);
lv_label_set_text_static(status, "Battery charging"); lv_label_set_text_static(status, "Charging");
} else if (batteryPercent == 100) { } else if (batteryPercent == 100) {
lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_BLUE); lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_BLUE);
lv_label_set_text_static(status, "Battery is fully charged"); lv_label_set_text_static(status, "Fully charged");
} else if (batteryPercent < 10) { } else if (batteryPercent < 10) {
lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_YELLOW); lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
lv_label_set_text_static(status, "Battery is low"); lv_label_set_text_static(status, "Battery low");
} else { } else {
lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_GREEN); lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_GREEN);
lv_label_set_text_static(status, "Battery discharging"); lv_label_set_text_static(status, "Discharging");
} }
lv_label_set_text_fmt(percent, "%02i%%", batteryPercent); lv_label_set_text_fmt(percent, "%02i%%", batteryPercent);