diff options
author | Barry Wardell <rockbox@barrywardell.net> | 2006-11-11 01:18:57 +0000 |
---|---|---|
committer | Barry Wardell <rockbox@barrywardell.net> | 2006-11-11 01:18:57 +0000 |
commit | 8d2711b7d2d9f19dc2375bd9395359ed725375ab (patch) | |
tree | 788f6dc4e010f7cf6eac2e3a5d3eebe2427fe06e /apps | |
parent | b3d2017057a47b1a5863d4e18e8d3eaf6a2fb63a (diff) |
Improved power management (FS#3001). Shutdown rockbox when the battery gets to a level where the device doesn't function properly. Calculate remaining charging time while charging (rather than remaining running time). Show "Low Battery" and "Battery Empty" warnings. Also fixes FS#4786.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11507 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lang/deutsch.lang | 28 | ||||
-rw-r--r-- | apps/lang/english.lang | 28 | ||||
-rw-r--r-- | apps/misc.c | 28 |
3 files changed, 75 insertions, 9 deletions
diff --git a/apps/lang/deutsch.lang b/apps/lang/deutsch.lang index 41d3747b22..43bc6952e8 100644 --- a/apps/lang/deutsch.lang +++ b/apps/lang/deutsch.lang @@ -9782,3 +9782,31 @@ *: "Keine Abspielliste" </voice> </phrase> +<phrase> + id: LANG_WARNING_BATTERY_LOW + desc: general warning + user: + <source> + *: "WARNING! Low Battery!" + </source> + <dest> + *: "WARNUNG! Batterie fast leer!" + </dest> + <voice> + *: "" + </voice> +</phrase> +<phrase> + id: LANG_WARNING_BATTERY_EMPTY + desc: general warning + user: + <source> + *: "Battery empty! RECHARGE!" + </source> + <dest> + *: "Batterie ist leer! AUFLADEN!" + </dest> + <voice> + *: "" + </voice> +</phrase> diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 0fce21ec08..9dd415901e 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -10196,3 +10196,31 @@ *: "New file" </voice> </phrase> +<phrase> + id: LANG_WARNING_BATTERY_LOW + desc: general warning + user: + <source> + *: "WARNING! Low Battery!" + </source> + <dest> + *: "WARNING! Low Battery!" + </dest> + <voice> + *: "" + </voice> +</phrase> +<phrase> + id: LANG_WARNING_BATTERY_EMPTY + desc: general warning + user: + <source> + *: "Battery empty! RECHARGE!" + </source> + <dest> + *: "Battery empty! RECHARGE!" + </dest> + <voice> + *: "" + </voice> +</phrase> diff --git a/apps/misc.c b/apps/misc.c index 7e4e5071a1..80c4588f0f 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -583,16 +583,25 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter) #ifdef X5_BACKLIGHT_SHUTDOWN x5_backlight_shutdown(); #endif + if (!battery_level_safe()) + gui_syncsplash(3*HZ, true, "%s %s", + str(LANG_WARNING_BATTERY_EMPTY), + str(LANG_SHUTTINGDOWN)); + else if (battery_level_critical()) + gui_syncsplash(3*HZ, true, "%s %s", + str(LANG_WARNING_BATTERY_LOW), + str(LANG_SHUTTINGDOWN)); + else { #ifdef HAVE_TAGCACHE - if (!tagcache_prepare_shutdown()) - { - cancel_shutdown(); - gui_syncsplash(HZ, true, str(LANG_TAGCACHE_BUSY)); - return false; - } + if (!tagcache_prepare_shutdown()) + { + cancel_shutdown(); + gui_syncsplash(HZ, true, str(LANG_TAGCACHE_BUSY)); + return false; + } #endif - - gui_syncsplash(0, true, str(LANG_SHUTTINGDOWN)); + gui_syncsplash(0, true, str(LANG_SHUTTINGDOWN)); + } if (global_settings.fade_on_stop && (audio_status() & AUDIO_STATUS_PLAY)) @@ -607,7 +616,8 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter) if (callback != NULL) callback(parameter); - system_flush(); + if (!battery_level_critical()) /* do not save on critical battery */ + system_flush(); #ifdef HAVE_EEPROM_SETTINGS if (firmware_settings.initialized) { |