diff options
-rw-r--r-- | apps/status.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/status.c b/apps/status.c index f88a552322..9744cd51ea 100644 --- a/apps/status.c +++ b/apps/status.c | |||
@@ -36,6 +36,7 @@ static enum playmode current_mode = STATUS_STOP; | |||
36 | bool statusbar_enabled = true; | 36 | bool statusbar_enabled = true; |
37 | long switch_tick; | 37 | long switch_tick; |
38 | bool plug_state; | 38 | bool plug_state; |
39 | bool battery_state; | ||
39 | #endif | 40 | #endif |
40 | 41 | ||
41 | void status_init(void) | 42 | void status_init(void) |
@@ -133,6 +134,7 @@ void status_draw(void) | |||
133 | statusbar_wipe(); | 134 | statusbar_wipe(); |
134 | #ifdef HAVE_CHARGE_CTRL | 135 | #ifdef HAVE_CHARGE_CTRL |
135 | if(charger_inserted()) { | 136 | if(charger_inserted()) { |
137 | battery_state=true; | ||
136 | if(!charger_enabled) | 138 | if(!charger_enabled) |
137 | plug_state=true; | 139 | plug_state=true; |
138 | else if(TIME_AFTER(current_tick, switch_tick)) { | 140 | else if(TIME_AFTER(current_tick, switch_tick)) { |
@@ -140,9 +142,18 @@ void status_draw(void) | |||
140 | switch_tick=current_tick+HZ; | 142 | switch_tick=current_tick+HZ; |
141 | } | 143 | } |
142 | } | 144 | } |
143 | else | 145 | else { |
144 | plug_state=false; | 146 | plug_state=false; |
145 | statusbar_icon_battery(battlevel,plug_state); | 147 | if(battlevel > (BATTERY_LEVEL_DANGEROUS-BATTERY_LEVEL_EMPTY)*100/BATTERY_RANGE) |
148 | battery_state=true; | ||
149 | else | ||
150 | if(TIME_AFTER(current_tick, switch_tick)) { | ||
151 | switch_tick=current_tick+HZ; | ||
152 | battery_state=!battery_state; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | if(battery_state) statusbar_icon_battery(battlevel,plug_state); | ||
146 | #else | 157 | #else |
147 | statusbar_icon_battery(battlevel,false); | 158 | statusbar_icon_battery(battlevel,false); |
148 | #endif | 159 | #endif |