summaryrefslogtreecommitdiff
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,
210 snprintf(buffer, buffer_len, str(LANG_BATTERY_TIME), 210 snprintf(buffer, buffer_len, str(LANG_BATTERY_TIME),
211 battery_level(), battery_time() / 60, battery_time() % 60); 211 battery_level(), battery_time() / 60, battery_time() % 60);
212 else 212 else
213 return "(n/a)"; 213 return "Battery n/a"; /* translating worth it? */
214 break; 214 break;
215 case INFO_DISK1: /* disk usage 1 */ 215 case INFO_DISK1: /* disk usage 1 */
216#ifdef HAVE_MULTIVOLUME 216#ifdef HAVE_MULTIVOLUME
@@ -289,9 +289,11 @@ static int info_speak_item(int selected_item, void * data)
289#endif /* CONFIG_CHARGING = */ 289#endif /* CONFIG_CHARGING = */
290 if (battery_level() >= 0) 290 if (battery_level() >= 0)
291 { 291 {
292 int time_left = battery_time();
292 talk_id(LANG_BATTERY_TIME, false); 293 talk_id(LANG_BATTERY_TIME, false);
293 talk_value(battery_level(), UNIT_PERCENT, true); 294 talk_value(battery_level(), UNIT_PERCENT, true);
294 talk_value(battery_time() *60, UNIT_TIME, true); 295 if (time_left >= 0)
296 talk_value(time_left * 60, UNIT_TIME, true);
295 } 297 }
296 else talk_id(VOICE_BLANK, false); 298 else talk_id(VOICE_BLANK, false);
297 break; 299 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,
219#if CONFIG_KEYPAD == RECORDER_PAD 219#if CONFIG_KEYPAD == RECORDER_PAD
220 &buttonbar, 220 &buttonbar,
221#endif 221#endif
222 &volume_type, &battery_display); 222 &volume_type
223#if (CONFIG_BATTERY_MEASURE != 0)
224 , &battery_display
225#endif
226 );
223#endif /* HAVE_LCD_BITMAP */ 227#endif /* HAVE_LCD_BITMAP */
224 228
225/* */ 229/* */