summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Braun <markus.braun@krawel.de>2002-08-09 11:56:54 +0000
committerMarkus Braun <markus.braun@krawel.de>2002-08-09 11:56:54 +0000
commitded1ef158a077c8dd75aeb84b428759082bda68b (patch)
treed428d6ee60d8662589c600143f7ff555861830f9
parentabcf8c929ed521af29e28d670468630577993d25 (diff)
downloadrockbox-ded1ef158a077c8dd75aeb84b428759082bda68b.tar.gz
rockbox-ded1ef158a077c8dd75aeb84b428759082bda68b.zip
Battery blinks if >BATTERY_LEVEL_DANGEROUS
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1641 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/status.c15
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;
36bool statusbar_enabled = true; 36bool statusbar_enabled = true;
37long switch_tick; 37long switch_tick;
38bool plug_state; 38bool plug_state;
39bool battery_state;
39#endif 40#endif
40 41
41void status_init(void) 42void 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