summaryrefslogtreecommitdiffstats
path: root/apps/menus
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2012-01-03 23:44:38 +0000
committerThomas Martitz <kugel@rockbox.org>2012-01-03 23:44:38 +0000
commitc1bd9b0361ba92c29ceef68d74093e70a1a3e481 (patch)
tree1a42acdf2099b7f5ac06eee11e1d488b388c6d9f /apps/menus
parent949e6398c89e3c277a4c542f67a5ee788c6f642d (diff)
downloadrockbox-c1bd9b0361ba92c29ceef68d74093e70a1a3e481.tar.gz
rockbox-c1bd9b0361ba92c29ceef68d74093e70a1a3e481.zip
Rework powermgmt to enable code re-use on appliation and sims.
* Introduce CONFIG_BATTERY_MEASURE define, to allow targets (application) to break powermgmt.c's assumption about the ability to read battery voltage. There's now additionally percentage (android) and remaining time measure (maemo). No measure at all also works (sdl app). If voltage can't be measured, then battery_level() is king and it'll be used for power_history and runtime estimation. * Implement target's API in the simulator, i.e. _battery_voltage(), so it doesn't need to implement it's own powermgmt.c and other stubs. Now the sim behaves much more like a native target, although it still changes the simulated battery voltage quickly, * Other changes include include renaming battery_adc_voltage() to _battery_voltage(), for consistency with the new target functions and making some of the apps code aware that voltage and runtime estimation is not always available. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31548 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/menus')
-rw-r--r--apps/menus/main_menu.c6
-rw-r--r--apps/menus/theme_menu.c6
2 files changed, 9 insertions, 3 deletions
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index cefc395b3d..b7472a6849 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -210,7 +210,7 @@ static const char* info_getname(int selected_item, void *data,
snprintf(buffer, buffer_len, str(LANG_BATTERY_TIME),
battery_level(), battery_time() / 60, battery_time() % 60);
else
- return "(n/a)";
+ return "Battery n/a"; /* translating worth it? */
break;
case INFO_DISK1: /* disk usage 1 */
#ifdef HAVE_MULTIVOLUME
@@ -289,9 +289,11 @@ static int info_speak_item(int selected_item, void * data)
#endif /* CONFIG_CHARGING = */
if (battery_level() >= 0)
{
+ int time_left = battery_time();
talk_id(LANG_BATTERY_TIME, false);
talk_value(battery_level(), UNIT_PERCENT, true);
- talk_value(battery_time() *60, UNIT_TIME, true);
+ if (time_left >= 0)
+ talk_value(time_left * 60, UNIT_TIME, true);
}
else talk_id(VOICE_BLANK, false);
break;
diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c
index e1077a5efd..5e04191ed1 100644
--- a/apps/menus/theme_menu.c
+++ b/apps/menus/theme_menu.c
@@ -219,7 +219,11 @@ MAKE_MENU(bars_menu, ID2P(LANG_BARS_MENU), 0, Icon_NOICON,
#if CONFIG_KEYPAD == RECORDER_PAD
&buttonbar,
#endif
- &volume_type, &battery_display);
+ &volume_type
+#if (CONFIG_BATTERY_MEASURE != 0)
+ , &battery_display
+#endif
+ );
#endif /* HAVE_LCD_BITMAP */
/* */