diff options
author | Thomas Martitz <kugel@rockbox.org> | 2012-01-03 23:44:38 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2012-01-03 23:44:38 +0000 |
commit | c1bd9b0361ba92c29ceef68d74093e70a1a3e481 (patch) | |
tree | 1a42acdf2099b7f5ac06eee11e1d488b388c6d9f /apps/menus/main_menu.c | |
parent | 949e6398c89e3c277a4c542f67a5ee788c6f642d (diff) | |
download | rockbox-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/main_menu.c')
-rw-r--r-- | apps/menus/main_menu.c | 6 |
1 files changed, 4 insertions, 2 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; |