diff options
author | Björn Stenberg <bjorn@haxx.se> | 2003-10-17 13:54:48 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2003-10-17 13:54:48 +0000 |
commit | fb067481a8d2ec5c890fab5860ab246d019eecc9 (patch) | |
tree | 9f5c0d8d3f808cc662abc1be3386e9c783027366 | |
parent | 2ec8e7d72b6e18cc79cea080b564df5fd1d50f3f (diff) | |
download | rockbox-fb067481a8d2ec5c890fab5860ab246d019eecc9.tar.gz rockbox-fb067481a8d2ec5c890fab5860ab246d019eecc9.zip |
Runtime display bug fix by Craig Sather (patch #766552)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3974 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/debug_menu.c | 12 | ||||
-rw-r--r-- | apps/settings.c | 2 | ||||
-rw-r--r-- | apps/settings.h | 1 | ||||
-rw-r--r-- | 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) | |||
1148 | #endif | 1148 | #endif |
1149 | 1149 | ||
1150 | if (state & 1) { | 1150 | if (state & 1) { |
1151 | if (charger_inserted()) | ||
1152 | { | ||
1153 | global_settings.runtime = 0; | ||
1154 | } | ||
1155 | else | ||
1156 | { | ||
1157 | global_settings.runtime += ((current_tick - lasttime) / HZ); | ||
1158 | } | ||
1159 | lasttime = current_tick; | ||
1160 | |||
1151 | t = global_settings.runtime; | 1161 | t = global_settings.runtime; |
1152 | lcd_puts(0, y++, "Current time"); | 1162 | lcd_puts(0, y++, "Current time"); |
1153 | } | 1163 | } |
@@ -1162,7 +1172,7 @@ static bool view_runtime(void) | |||
1162 | lcd_update(); | 1172 | lcd_update(); |
1163 | 1173 | ||
1164 | /* Wait for a key to be pushed */ | 1174 | /* Wait for a key to be pushed */ |
1165 | key = button_get_w_tmo(HZ*5); | 1175 | key = button_get_w_tmo(HZ); |
1166 | switch(key) { | 1176 | switch(key) { |
1167 | #ifdef HAVE_PLAYER_KEYPAD | 1177 | #ifdef HAVE_PLAYER_KEYPAD |
1168 | case BUTTON_STOP | BUTTON_REL: | 1178 | 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: | |||
151 | *************************************/ | 151 | *************************************/ |
152 | 152 | ||
153 | #include "rtc.h" | 153 | #include "rtc.h" |
154 | long lasttime = 0; | ||
154 | static unsigned char config_block[CONFIG_BLOCK_SIZE]; | 155 | static unsigned char config_block[CONFIG_BLOCK_SIZE]; |
155 | 156 | ||
156 | /* | 157 | /* |
@@ -372,7 +373,6 @@ int settings_save( void ) | |||
372 | ((global_settings.trickle_charge & 1) << 4)); | 373 | ((global_settings.trickle_charge & 1) << 4)); |
373 | 374 | ||
374 | { | 375 | { |
375 | static long lasttime = 0; | ||
376 | int elapsed_secs; | 376 | int elapsed_secs; |
377 | 377 | ||
378 | elapsed_secs = (current_tick - lasttime) / HZ; | 378 | 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; | |||
201 | /* name of directory where configuration, fonts and other data | 201 | /* name of directory where configuration, fonts and other data |
202 | * files are stored */ | 202 | * files are stored */ |
203 | extern char rockboxdir[]; | 203 | extern char rockboxdir[]; |
204 | extern long lasttime; | ||
204 | 205 | ||
205 | /* system defines */ | 206 | /* system defines */ |
206 | 207 | ||
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) | |||
137 | plug_state = true; | 137 | plug_state = true; |
138 | #ifdef HAVE_CHARGE_CTRL | 138 | #ifdef HAVE_CHARGE_CTRL |
139 | /* zero battery run time if charging */ | 139 | /* zero battery run time if charging */ |
140 | if (charge_state > 0) | 140 | if (charge_state > 0) { |
141 | global_settings.runtime = 0; | 141 | global_settings.runtime = 0; |
142 | lasttime = current_tick; | ||
143 | } | ||
142 | 144 | ||
143 | /* animate battery if charging */ | 145 | /* animate battery if charging */ |
144 | if (charge_state == 1) { | 146 | if (charge_state == 1) { |
145 | #else | 147 | #else |
148 | global_settings.runtime = 0; | ||
149 | lasttime = current_tick; | ||
146 | { | 150 | { |
147 | #endif | 151 | #endif |
148 | /* animate in three steps (34% per step for a better look) */ | 152 | /* animate in three steps (34% per step for a better look) */ |