summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/plugin.c2
-rw-r--r--apps/plugin.h2
-rw-r--r--firmware/drivers/button.c10
-rw-r--r--firmware/export/button.h1
-rw-r--r--firmware/export/powermgmt.h1
-rw-r--r--firmware/powermgmt.c9
-rw-r--r--uisimulator/win32/button.c4
7 files changed, 18 insertions, 11 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index a990463b8c..b7646c021d 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -240,6 +240,8 @@ static struct plugin_api rockbox_api = {
#ifdef HAVE_LCD_CHARCELLS
lcd_icon,
#endif
+
+ reset_poweroff_timer,
};
int plugin_load(char* plugin, void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index ec16376b11..1405ba3924 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -276,6 +276,8 @@ struct plugin_api {
#ifdef HAVE_LCD_CHARCELLS
void (*lcd_icon)(int icon, bool enable);
#endif
+
+ void (*reset_poweroff_timer)(void);
};
/* defined by the plugin loader (plugin.c) */
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index f3b90211cd..9f19bc0945 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -31,10 +31,10 @@
#include "serial.h"
#include "power.h"
#include "system.h"
+#include "powermgmt.h"
struct event_queue button_queue;
-long last_keypress;
static int lastbtn;
#ifdef HAVE_RECORDER_KEYPAD
static bool flipped; /* bottons can be flipped to match the LCD flip */
@@ -141,7 +141,7 @@ static void button_tick(void)
queue_post(&button_queue, btn, NULL);
backlight_on();
- last_keypress = current_tick;
+ reset_poweroff_timer();
}
}
else
@@ -216,7 +216,7 @@ void button_init()
queue_init(&button_queue);
lastbtn = 0;
tick_add_task(button_tick);
- last_keypress = current_tick;
+ reset_poweroff_timer();
flipped = false;
}
@@ -359,7 +359,7 @@ void button_init(void)
lastbtn = 0;
tick_add_task(button_tick);
- last_keypress = current_tick;
+ reset_poweroff_timer();
}
static int button_read(void)
@@ -396,7 +396,7 @@ void button_init(void)
lastbtn = 0;
tick_add_task(button_tick);
- last_keypress = current_tick;
+ reset_poweroff_timer();
}
int button_read(void)
{
diff --git a/firmware/export/button.h b/firmware/export/button.h
index efe3684473..d1d5ddea5c 100644
--- a/firmware/export/button.h
+++ b/firmware/export/button.h
@@ -24,7 +24,6 @@
#include "config.h"
extern struct event_queue button_queue;
-extern long last_keypress;
void button_init (void);
int button_get (bool block);
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index 72a36b04bf..eb0ba29f28 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -100,5 +100,6 @@ void set_battery_capacity(int capacity); /* set local battery capacity value */
void set_sleep_timer(int seconds);
int get_sleep_timer(void);
void set_car_adapter_mode(bool setting);
+void reset_poweroff_timer(void);
#endif
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))
{
diff --git a/uisimulator/win32/button.c b/uisimulator/win32/button.c
index 807e08fe22..c9bd1ad04e 100644
--- a/uisimulator/win32/button.c
+++ b/uisimulator/win32/button.c
@@ -33,7 +33,6 @@
/* speed repeat finishes at */
#define REPEAT_INTERVAL_FINISH 2
-long last_keypress;
struct event_queue button_queue;
void button_event(int key, bool pressed)
@@ -160,8 +159,6 @@ void button_event(int key, bool pressed)
queue_post(&button_queue, btn, NULL);
backlight_on();
-
- last_keypress = current_tick;
}
}
else
@@ -175,7 +172,6 @@ void button_event(int key, bool pressed)
void button_init(void)
{
- last_keypress = 0;
}
/* Again copied from real button.c... */