diff options
author | Björn Stenberg <bjorn@haxx.se> | 2003-10-17 14:05:32 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2003-10-17 14:05:32 +0000 |
commit | 3953211531b382ad23b82f35223c0ca82ed9814f (patch) | |
tree | 807f8882c9eaa7c9fe04b9d9feef6256991e543c | |
parent | fb067481a8d2ec5c890fab5860ab246d019eecc9 (diff) | |
download | rockbox-3953211531b382ad23b82f35223c0ca82ed9814f.tar.gz rockbox-3953211531b382ad23b82f35223c0ca82ed9814f.zip |
Fixes sleep timer when connected to charger (patch #769591 by Henrik Backe)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3975 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/wps.c | 14 | ||||
-rw-r--r-- | firmware/powermgmt.c | 24 |
2 files changed, 27 insertions, 11 deletions
diff --git a/apps/wps.c b/apps/wps.c index d41413c179..f34ec81d9c 100644 --- a/apps/wps.c +++ b/apps/wps.c | |||
@@ -738,6 +738,12 @@ int wps_show(void) | |||
738 | continue; | 738 | continue; |
739 | } | 739 | } |
740 | 740 | ||
741 | /* Exit if mpeg has stopped playing. This can happen if using the | ||
742 | sleep timer with the charger plugged or if starting a recording | ||
743 | from F1 */ | ||
744 | if (!mpeg_status()) | ||
745 | exit = true; | ||
746 | |||
741 | switch(button) | 747 | switch(button) |
742 | { | 748 | { |
743 | case BUTTON_ON: | 749 | case BUTTON_ON: |
@@ -882,10 +888,6 @@ int wps_show(void) | |||
882 | if (menu()) | 888 | if (menu()) |
883 | return SYS_USB_CONNECTED; | 889 | return SYS_USB_CONNECTED; |
884 | 890 | ||
885 | /* if user recorded, playback is stopped and we should exit */ | ||
886 | if (!mpeg_status()) | ||
887 | exit = true; | ||
888 | |||
889 | restore = true; | 891 | restore = true; |
890 | break; | 892 | break; |
891 | 893 | ||
@@ -947,6 +949,10 @@ int wps_show(void) | |||
947 | mpeg_stop(); | 949 | mpeg_stop(); |
948 | status_set_playmode(STATUS_STOP); | 950 | status_set_playmode(STATUS_STOP); |
949 | 951 | ||
952 | /* Keys can be locked when exiting, so either unlock here | ||
953 | or implement key locking in tree.c too */ | ||
954 | keys_locked=false; | ||
955 | |||
950 | /* set dir browser to current playing song */ | 956 | /* set dir browser to current playing song */ |
951 | if (global_settings.browse_current && | 957 | if (global_settings.browse_current && |
952 | current_track_path[0] != '\0') | 958 | current_track_path[0] != '\0') |
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index e4cdcde300..21ccddf301 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -306,25 +306,35 @@ static void handle_auto_poweroff(void) | |||
306 | #endif | 306 | #endif |
307 | !usb_inserted() && | 307 | !usb_inserted() && |
308 | (mpeg_stat == 0 || | 308 | (mpeg_stat == 0 || |
309 | mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE))) | 309 | (mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)) && |
310 | !sleeptimer_active)) | ||
310 | { | 311 | { |
311 | if(TIME_AFTER(current_tick, last_keypress + timeout) && | 312 | if(TIME_AFTER(current_tick, last_keypress + timeout) && |
312 | TIME_AFTER(current_tick, last_disk_activity + timeout) && | 313 | TIME_AFTER(current_tick, last_disk_activity + timeout)) |
313 | TIME_AFTER(current_tick, last_charge_time + timeout)) | 314 | { |
314 | power_off(); | 315 | if (mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)) |
316 | { | ||
317 | mpeg_stop(); | ||
318 | } | ||
319 | |||
320 | if (TIME_AFTER(current_tick, last_charge_time + timeout)) | ||
321 | { | ||
322 | power_off(); | ||
323 | } | ||
324 | } | ||
315 | } | 325 | } |
316 | else | 326 | else |
317 | { | 327 | { |
318 | /* Handle sleeptimer */ | 328 | /* Handle sleeptimer */ |
319 | if(sleeptimer_endtick && | 329 | if(sleeptimer_active && !usb_inserted()) |
320 | !usb_inserted()) | ||
321 | { | 330 | { |
322 | if(TIME_AFTER(current_tick, sleeptimer_endtick)) | 331 | if(TIME_AFTER(current_tick, sleeptimer_endtick)) |
323 | { | 332 | { |
333 | mpeg_stop(); | ||
324 | if(charger_is_inserted) | 334 | if(charger_is_inserted) |
325 | { | 335 | { |
326 | DEBUGF("Sleep timer timeout. Stopping...\n"); | 336 | DEBUGF("Sleep timer timeout. Stopping...\n"); |
327 | mpeg_stop(); | 337 | set_sleep_timer(0); |
328 | } | 338 | } |
329 | else | 339 | else |
330 | { | 340 | { |