summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2003-10-17 14:05:32 +0000
committerBjörn Stenberg <bjorn@haxx.se>2003-10-17 14:05:32 +0000
commit3953211531b382ad23b82f35223c0ca82ed9814f (patch)
tree807f8882c9eaa7c9fe04b9d9feef6256991e543c
parentfb067481a8d2ec5c890fab5860ab246d019eecc9 (diff)
downloadrockbox-3953211531b382ad23b82f35223c0ca82ed9814f.zip
rockbox-3953211531b382ad23b82f35223c0ca82ed9814f.tar.gz
rockbox-3953211531b382ad23b82f35223c0ca82ed9814f.tar.bz2
rockbox-3953211531b382ad23b82f35223c0ca82ed9814f.tar.xz
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.c14
-rw-r--r--firmware/powermgmt.c24
2 files changed, 27 insertions, 11 deletions
diff --git a/apps/wps.c b/apps/wps.c
index d41413c..f34ec81 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -738,6 +738,12 @@ int wps_show(void)
continue;
}
+ /* Exit if mpeg has stopped playing. This can happen if using the
+ sleep timer with the charger plugged or if starting a recording
+ from F1 */
+ if (!mpeg_status())
+ exit = true;
+
switch(button)
{
case BUTTON_ON:
@@ -882,10 +888,6 @@ int wps_show(void)
if (menu())
return SYS_USB_CONNECTED;
- /* if user recorded, playback is stopped and we should exit */
- if (!mpeg_status())
- exit = true;
-
restore = true;
break;
@@ -947,6 +949,10 @@ int wps_show(void)
mpeg_stop();
status_set_playmode(STATUS_STOP);
+ /* Keys can be locked when exiting, so either unlock here
+ or implement key locking in tree.c too */
+ keys_locked=false;
+
/* set dir browser to current playing song */
if (global_settings.browse_current &&
current_track_path[0] != '\0')
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index e4cdcde..21ccddf 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -306,25 +306,35 @@ static void handle_auto_poweroff(void)
#endif
!usb_inserted() &&
(mpeg_stat == 0 ||
- mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)))
+ (mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)) &&
+ !sleeptimer_active))
{
if(TIME_AFTER(current_tick, last_keypress + timeout) &&
- TIME_AFTER(current_tick, last_disk_activity + timeout) &&
- TIME_AFTER(current_tick, last_charge_time + timeout))
- power_off();
+ TIME_AFTER(current_tick, last_disk_activity + timeout))
+ {
+ if (mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE))
+ {
+ mpeg_stop();
+ }
+
+ if (TIME_AFTER(current_tick, last_charge_time + timeout))
+ {
+ power_off();
+ }
+ }
}
else
{
/* Handle sleeptimer */
- if(sleeptimer_endtick &&
- !usb_inserted())
+ if(sleeptimer_active && !usb_inserted())
{
if(TIME_AFTER(current_tick, sleeptimer_endtick))
{
+ mpeg_stop();
if(charger_is_inserted)
{
DEBUGF("Sleep timer timeout. Stopping...\n");
- mpeg_stop();
+ set_sleep_timer(0);
}
else
{