aboutsummaryrefslogtreecommitdiffstats
path: root/src/displayapp/screens/BatteryInfo.cpp
diff options
context:
space:
mode:
authorJF002 <JF002@users.noreply.github.com>2021-04-16 19:57:35 +0200
committerGitHub <noreply@github.com>2021-04-16 19:57:35 +0200
commit36e27842e146ddcfbcd5dcef4ebb2c92955242be (patch)
tree54c2b4f658a82d5effc5f1a19f5937006aa748cd /src/displayapp/screens/BatteryInfo.cpp
parenteb769fb60ecb8f96ecf6901082ec3f0610842af8 (diff)
parent3c413bdd5283f6ef95d23a4b7274722da680f039 (diff)
Merge pull request #263 from joaquimorg/0.16.0Update
Fix Issue #262 for 0.16.0 version
Diffstat (limited to 'src/displayapp/screens/BatteryInfo.cpp')
-rw-r--r--src/displayapp/screens/BatteryInfo.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/displayapp/screens/BatteryInfo.cpp b/src/displayapp/screens/BatteryInfo.cpp
index ae39138f..e616d67f 100644
--- a/src/displayapp/screens/BatteryInfo.cpp
+++ b/src/displayapp/screens/BatteryInfo.cpp
@@ -84,7 +84,7 @@ void BatteryInfo::UpdateAnim() {
batteryPercent = batteryController.PercentRemaining();
if ( batteryPercent >= 0 ) {
- if ( batteryController.IsCharging() ) {
+ if ( batteryController.IsCharging() and batteryPercent < 100 ) {
animation +=1;
if (animation >= 100) {
animation = 0;
@@ -111,12 +111,17 @@ void BatteryInfo::UpdateScreen() {
batteryVoltage = batteryController.Voltage();
if ( batteryPercent >= 0 ) {
- if ( batteryController.IsCharging() ) {
- lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, lv_color_hex(0xFF0000));
+ 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,"Battery charging");
-
+ } else if ( batteryPercent == 100 ) {
+ 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");
+ } else if ( batteryPercent < 10 ) {
+ 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");
} else {
- lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, lv_color_hex(0x00FF00));
+ 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");
}