summaryrefslogtreecommitdiffstats
path: root/firmware/powermgmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/powermgmt.c')
-rw-r--r--firmware/powermgmt.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 61006459ff..aade687ba8 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -38,6 +38,13 @@
#include "fmradio.h"
#endif
+long last_event_tick;
+
+void reset_poweroff_timer(void)
+{
+ last_event_tick = current_tick;
+}
+
#ifdef SIMULATOR
int battery_level(void)
@@ -316,7 +323,7 @@ static void handle_auto_poweroff(void)
((mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)) &&
!sleeptimer_active)))
{
- if(TIME_AFTER(current_tick, last_keypress + timeout) &&
+ if(TIME_AFTER(current_tick, last_event_tick + timeout) &&
TIME_AFTER(current_tick, last_disk_activity + timeout) &&
TIME_AFTER(current_tick, last_charge_time + timeout))
{