diff options
| author | Björn Stenberg <bjorn@haxx.se> | 2002-12-03 14:18:51 +0000 |
|---|---|---|
| committer | Björn Stenberg <bjorn@haxx.se> | 2002-12-03 14:18:51 +0000 |
| commit | f09c5f4c63e51cc05a9737d3d82dac90054a3b5e (patch) | |
| tree | 86b383e83a0d7ccf0aeb8b7155748db5c74eb409 /apps | |
| parent | 67938f3451f056d9e1f4b56abf6acc54ea4a38b2 (diff) | |
| download | rockbox-f09c5f4c63e51cc05a9737d3d82dac90054a3b5e.zip rockbox-f09c5f4c63e51cc05a9737d3d82dac90054a3b5e.tar.gz rockbox-f09c5f4c63e51cc05a9737d3d82dac90054a3b5e.tar.bz2 rockbox-f09c5f4c63e51cc05a9737d3d82dac90054a3b5e.tar.xz | |
Finally, merged the improved power code from Uwe Freese:
- The battery level (percentage) is more realistic and considers if the charger is on.
- It considers the "lazyness" a battery shows when the charging has just turned on or off (see below). But this is not perfect by now.
- The battery level is good enough to estimate the remaining running time and the remaining charging time. And so the info screen now shows this info.
- The maximum time of a charging cycle is now dynamically calculated out of the battery level (percentage) and is not a fixed value.
- A minimum of 60 minutes is waited after a charging cycle stops before another one starts.
- Added another screen in the battery debug screen (press down three times).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2913 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/debug_menu.c | 62 | ||||
| -rw-r--r-- | apps/lang/english.lang | 4 | ||||
| -rw-r--r-- | apps/main_menu.c | 12 |
3 files changed, 47 insertions, 31 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 3aca2b8..772e932 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -78,9 +78,8 @@ bool dbg_os(void) } lcd_update(); - sleep(HZ/10); - button = button_get(false); + button = button_get_w_tmo(HZ/10); switch(button) { @@ -112,9 +111,7 @@ bool dbg_os(void) snprintf(buf, 32, "%d: %d%% ", currval, usage); lcd_puts(0, 1, buf); - sleep(HZ/10); - - button = button_get(false); + button = button_get_w_tmo(HZ/10); switch(button) { @@ -333,7 +330,7 @@ bool dbg_partitions(void) lcd_puts(0, 0, "Partition"); lcd_puts(0, 1, "list"); lcd_update(); - sleep(HZ); + sleep(HZ/2); while(1) { @@ -431,9 +428,7 @@ bool dbg_ports(void) lcd_puts(0, 7, buf); lcd_update(); - sleep(HZ/10); - - button = button_get(false); + button = button_get(HZ/10); switch(button) { @@ -513,9 +508,7 @@ bool dbg_ports(void) snprintf(buf, 32, "Batt: %d.%02dV", batt_int, batt_frac); lcd_puts(0, 1, buf); - sleep(HZ/5); - - button = button_get(false); + button = button_get_w_tmo(HZ/5); switch(button) { @@ -566,9 +559,8 @@ bool dbg_rtc(void) } lcd_update(); - sleep(HZ/2); - button = button_get(false); + button = button_get_w_tmo(HZ/2); switch(button) { @@ -623,9 +615,8 @@ bool dbg_mas(void) } lcd_update(); - sleep(HZ/16); - switch(button_get(false)) + switch(button_get_w_tmo(HZ/16)) { #ifdef HAVE_RECORDER_KEYPAD case BUTTON_DOWN: @@ -674,9 +665,8 @@ bool dbg_mas_codec(void) } lcd_update(); - sleep(HZ/16); - switch(button_get(false)) + switch(button_get_w_tmo(HZ/16)) { case BUTTON_DOWN: addr += 4; @@ -805,12 +795,42 @@ bool view_battery(void) lcd_puts(0, i+1, buf); } break; + + case 3: /* remeining time estimation: */ + lcd_clear_display(); + lcd_puts(0, 0, "Remaining time:"); + + snprintf(buf, 30, "Cycle time: %d m", powermgmt_last_cycle_startstop_min); + lcd_puts(0, 1, buf); + + snprintf(buf, 30, "Lev.at cycle start: %d%%", powermgmt_last_cycle_level); + lcd_puts(0, 2, buf); + + snprintf(buf, 30, "Last PwrHist val: %d.%02d V", + power_history[POWER_HISTORY_LEN-1] / 100, + power_history[POWER_HISTORY_LEN-1] % 100); + lcd_puts(0, 3, buf); + + snprintf(buf, 30, "Lazy time amount: %d%%", + (powermgmt_last_cycle_startstop_min < 20) + ? battery_lazyness[powermgmt_last_cycle_startstop_min] + : 0); + lcd_puts(0, 4, buf); + + snprintf(buf, 30, "resulting act.lev: %d%%", battery_level()); + lcd_puts(0, 5, buf); + + snprintf(buf, 30, "Est. remaining: %d m", powermgmt_est_runningtime_min); + lcd_puts(0, 6, buf); + +#ifdef HAVE_CHARGE_CTRL +#endif + break; } lcd_update(); - sleep(HZ/2); - switch(button_get(false)) + switch(button_get_w_tmo(HZ/2)) { case BUTTON_UP: if (view) @@ -818,7 +838,7 @@ bool view_battery(void) break; case BUTTON_DOWN: - if (view < 2) + if (view < 3) view++; break; diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 82d22a7..4527029 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -1162,3 +1162,7 @@ desc: show only playlist eng: "Playlists" new: +id: LANG_BATTERY_TIME +desc: battery level in % and estimated time remaining +eng: "%d%% %dh %dm" +new: diff --git a/apps/main_menu.c b/apps/main_menu.c index 49ad9c9..a5517f9 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c @@ -183,21 +183,13 @@ bool show_info(void) #endif lcd_puts(0, y++, s); -#ifdef HAVE_LCD_CHARCELLS - snprintf(s, sizeof(s), str(LANG_BATTERY_LEVEL_PLAYER), - battery_level(), battery_level_safe() ? "" : "!"); -#else #ifdef HAVE_CHARGE_CTRL if (charger_enabled) snprintf(s, sizeof(s), str(LANG_BATTERY_CHARGE)); else - snprintf(s, sizeof(s), str(LANG_BATTERY_LEVEL_RECORDER), - battery_level(), battery_level_safe() ? "" : " !!"); -#else - snprintf(s, sizeof(s), str(LANG_BATTERY_LEVEL_RECORDER), - battery_level(), battery_level_safe() ? "" : " !!"); -#endif #endif + snprintf(s, sizeof(s), str(LANG_BATTERY_TIME), battery_level(), + battery_time() / 60, battery_time() % 60); lcd_puts(0, y++, s); } |