From fb067481a8d2ec5c890fab5860ab246d019eecc9 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Fri, 17 Oct 2003 13:54:48 +0000 Subject: Runtime display bug fix by Craig Sather (patch #766552) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3974 a1c6a512-1295-4272-9138-f99709370657 --- apps/debug_menu.c | 12 +++++++++++- apps/settings.c | 2 +- apps/settings.h | 1 + apps/status.c | 6 +++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/debug_menu.c b/apps/debug_menu.c index f27bbac099..a2cda985d4 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1148,6 +1148,16 @@ static bool view_runtime(void) #endif if (state & 1) { + if (charger_inserted()) + { + global_settings.runtime = 0; + } + else + { + global_settings.runtime += ((current_tick - lasttime) / HZ); + } + lasttime = current_tick; + t = global_settings.runtime; lcd_puts(0, y++, "Current time"); } @@ -1162,7 +1172,7 @@ static bool view_runtime(void) lcd_update(); /* Wait for a key to be pushed */ - key = button_get_w_tmo(HZ*5); + key = button_get_w_tmo(HZ); switch(key) { #ifdef HAVE_PLAYER_KEYPAD case BUTTON_STOP | BUTTON_REL: diff --git a/apps/settings.c b/apps/settings.c index 15d1103646..e31a2d47d3 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -151,6 +151,7 @@ Rest of config block, only saved to disk: *************************************/ #include "rtc.h" +long lasttime = 0; static unsigned char config_block[CONFIG_BLOCK_SIZE]; /* @@ -372,7 +373,6 @@ int settings_save( void ) ((global_settings.trickle_charge & 1) << 4)); { - static long lasttime = 0; int elapsed_secs; elapsed_secs = (current_tick - lasttime) / HZ; diff --git a/apps/settings.h b/apps/settings.h index 9f857e7f5d..c3772ad7ff 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -201,6 +201,7 @@ extern struct user_settings global_settings; /* name of directory where configuration, fonts and other data * files are stored */ extern char rockboxdir[]; +extern long lasttime; /* system defines */ diff --git a/apps/status.c b/apps/status.c index 7217568f60..6f412d81b1 100644 --- a/apps/status.c +++ b/apps/status.c @@ -137,12 +137,16 @@ void status_draw(bool force_redraw) plug_state = true; #ifdef HAVE_CHARGE_CTRL /* zero battery run time if charging */ - if (charge_state > 0) + if (charge_state > 0) { global_settings.runtime = 0; + lasttime = current_tick; + } /* animate battery if charging */ if (charge_state == 1) { #else + global_settings.runtime = 0; + lasttime = current_tick; { #endif /* animate in three steps (34% per step for a better look) */ -- cgit v1.2.3