@@ -84,7 +84,7 @@ void BatteryInfo::UpdateAnim() {
8484 batteryPercent = batteryController.PercentRemaining ();
8585
8686 if ( batteryPercent >= 0 ) {
87- if ( batteryController.IsCharging () ) {
87+ if ( batteryController.IsCharging () and batteryPercent < 100 ) {
8888 animation +=1 ;
8989 if (animation >= 100 ) {
9090 animation = 0 ;
@@ -111,12 +111,17 @@ void BatteryInfo::UpdateScreen() {
111111 batteryVoltage = batteryController.Voltage ();
112112
113113 if ( batteryPercent >= 0 ) {
114- if ( batteryController.IsCharging () ) {
115- lv_obj_set_style_local_bg_color (charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, lv_color_hex ( 0xFF0000 ) );
114+ if ( batteryController.IsCharging () and batteryPercent < 100 ) {
115+ lv_obj_set_style_local_bg_color (charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_RED );
116116 lv_label_set_text_static (status," Battery charging" );
117-
117+ } else if ( batteryPercent == 100 ) {
118+ lv_obj_set_style_local_bg_color (charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_BLUE);
119+ lv_label_set_text_static (status," Battery is fully charged" );
120+ } else if ( batteryPercent < 10 ) {
121+ lv_obj_set_style_local_bg_color (charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_YELLOW);
122+ lv_label_set_text_static (status," Battery is low" );
118123 } else {
119- lv_obj_set_style_local_bg_color (charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, lv_color_hex ( 0x00FF00 ) );
124+ lv_obj_set_style_local_bg_color (charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_GREEN );
120125 lv_label_set_text_static (status," Battery discharging" );
121126 }
122127
0 commit comments