diff options
author | Brandon Low <lostlogic@rockbox.org> | 2006-01-19 07:47:34 +0000 |
---|---|---|
committer | Brandon Low <lostlogic@rockbox.org> | 2006-01-19 07:47:34 +0000 |
commit | cdacab3d89cdbbd8fd7c20b3b340e27352e6737e (patch) | |
tree | ad1746cf51bdb56a1cdcabf0c38eb6a53244c431 /apps/gui/statusbar.c | |
parent | 13414ae77a77d96ef2cb210d644880b847c9ca6f (diff) | |
download | rockbox-cdacab3d89cdbbd8fd7c20b3b340e27352e6737e.tar.gz rockbox-cdacab3d89cdbbd8fd7c20b3b340e27352e6737e.zip |
Charging state reporting on H3x0
Don't read the GPIO every refresh of statusbar or gwps for plugged state, use a
variable exported from powermgmt instead.
Allow Custom WPS to access %bc for battery charge state on targets that support
this.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8383 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/statusbar.c')
-rw-r--r-- | apps/gui/statusbar.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index 80de707a72..b4070394f9 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c | |||
@@ -127,7 +127,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
127 | #endif /* HAVE_LCD_CHARCELLS */ | 127 | #endif /* HAVE_LCD_CHARCELLS */ |
128 | 128 | ||
129 | bar->info.volume = sound_val2phys(SOUND_VOLUME, global_settings.volume); | 129 | bar->info.volume = sound_val2phys(SOUND_VOLUME, global_settings.volume); |
130 | bar->info.inserted = charger_inserted(); | 130 | bar->info.inserted = (charger_input_state == CHARGER); |
131 | bar->info.battlevel = battery_level(); | 131 | bar->info.battlevel = battery_level(); |
132 | bar->info.battery_safe = battery_level_safe(); | 132 | bar->info.battery_safe = battery_level_safe(); |
133 | 133 | ||
@@ -178,16 +178,21 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
178 | #ifdef HAVE_CHARGING | 178 | #ifdef HAVE_CHARGING |
179 | if (bar->info.inserted) { | 179 | if (bar->info.inserted) { |
180 | battery_state = true; | 180 | battery_state = true; |
181 | #if defined(HAVE_CHARGE_CTRL) || CONFIG_BATTERY == BATT_LIION2200 | 181 | #if defined(HAVE_CHARGE_CTRL) || \ |
182 | defined(HAVE_CHARGE_STATE) || \ | ||
183 | CONFIG_BATTERY == BATT_LIION2200 | ||
182 | /* zero battery run time if charging */ | 184 | /* zero battery run time if charging */ |
183 | if (charge_state > 0) { | 185 | if (charge_state > DISCHARGING) { |
184 | global_settings.runtime = 0; | 186 | global_settings.runtime = 0; |
185 | lasttime = current_tick; | 187 | lasttime = current_tick; |
186 | } | 188 | } |
187 | 189 | ||
188 | /* animate battery if charging */ | 190 | /* animate battery if charging */ |
189 | if ((charge_state == 1) || | 191 | if ((charge_state == CHARGING) |
190 | (charge_state == 2)) { | 192 | #ifdef HAVE_CHARGE_CTRL |
193 | || (charge_state == TOPOFF) | ||
194 | #endif | ||
195 | ) { | ||
191 | #else | 196 | #else |
192 | global_settings.runtime = 0; | 197 | global_settings.runtime = 0; |
193 | lasttime = current_tick; | 198 | lasttime = current_tick; |
@@ -323,7 +328,8 @@ void gui_statusbar_icon_battery(struct screen * display, int percent) | |||
323 | if (fill > 100) | 328 | if (fill > 100) |
324 | fill = 100; | 329 | fill = 100; |
325 | 330 | ||
326 | #if defined(HAVE_CHARGE_CTRL) && !defined(SIMULATOR) /* Rec v1 target only */ | 331 | #if (defined(HAVE_CHARGE_CTRL) || defined(HAVE_CHARGE_STATE)) && \ |
332 | !defined(SIMULATOR) /* Certain charge controlled targets */ | ||
327 | /* show graphical animation when charging instead of numbers */ | 333 | /* show graphical animation when charging instead of numbers */ |
328 | if ((global_settings.battery_display) && | 334 | if ((global_settings.battery_display) && |
329 | (charge_state != 1) && | 335 | (charge_state != 1) && |