diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-06-29 19:01:24 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-06-29 19:01:24 +0000 |
commit | da5910eac0629c4ac38c7967160e455ae6db9915 (patch) | |
tree | 551cdd72c3aa945fcd97659ccf71da31f3ca4643 /firmware/powermgmt.c | |
parent | 63c266e5e543cf7341418b1a83e938d05ede2c7d (diff) | |
download | rockbox-da5910eac0629c4ac38c7967160e455ae6db9915.tar.gz rockbox-da5910eac0629c4ac38c7967160e455ae6db9915.zip |
Shutdown and powermanagement cleanup: * Use the proper function for determining whether the battery level is safe, and get rid of the extra one. Low battery warning now appears at 10% or less. * Don't delay shutdown artificially by 3 seconds due to low/critical battery warning. * Shutdown at critical battery level: Skip all disk-hitting housekeeping, make sure dircache stops, and don't mark disk as clean in eeprom.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13734 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/powermgmt.c')
-rw-r--r-- | firmware/powermgmt.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 000a8bb2ec..26323c43ab 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -143,11 +143,6 @@ bool battery_level_safe(void) | |||
143 | return battery_level() >= 10; | 143 | return battery_level() >= 10; |
144 | } | 144 | } |
145 | 145 | ||
146 | bool battery_level_critical(void) | ||
147 | { | ||
148 | return false; | ||
149 | } | ||
150 | |||
151 | void set_poweroff_timeout(int timeout) | 146 | void set_poweroff_timeout(int timeout) |
152 | { | 147 | { |
153 | (void)timeout; | 148 | (void)timeout; |
@@ -422,12 +417,6 @@ bool battery_level_safe(void) | |||
422 | return battery_centivolts > battery_level_dangerous[battery_type]; | 417 | return battery_centivolts > battery_level_dangerous[battery_type]; |
423 | } | 418 | } |
424 | 419 | ||
425 | /* Tells if the battery is in critical powersaving state */ | ||
426 | bool battery_level_critical(void) | ||
427 | { | ||
428 | return ((battery_capacity * battery_percent / BATTERY_CAPACITY_MIN) < 10); | ||
429 | } | ||
430 | |||
431 | void set_poweroff_timeout(int timeout) | 420 | void set_poweroff_timeout(int timeout) |
432 | { | 421 | { |
433 | poweroff_timeout = timeout; | 422 | poweroff_timeout = timeout; |
@@ -1291,7 +1280,7 @@ void shutdown_hw(void) | |||
1291 | } | 1280 | } |
1292 | #endif | 1281 | #endif |
1293 | audio_stop(); | 1282 | audio_stop(); |
1294 | if (!battery_level_critical()) { /* do not save on critical battery */ | 1283 | if (battery_level_safe()) { /* do not save on critical battery */ |
1295 | #ifdef HAVE_LCD_BITMAP | 1284 | #ifdef HAVE_LCD_BITMAP |
1296 | glyph_cache_save(); | 1285 | glyph_cache_save(); |
1297 | #endif | 1286 | #endif |