Index: apps/lang/english.lang =================================================================== --- apps/lang/english.lang (revision 30842) +++ apps/lang/english.lang (working copy) @@ -12903,3 +12903,17 @@ *: "Cancel Sleep Timer" + + id: LANG_KEYPRESS_RESTARTS_SLEEP_TIMER + desc: whether to restart running sleep timer on keypress + user: core + + *: "Restart Sleep Timer On Keypress" + + + *: "Restart Sleep Timer On Keypress" + + + *: "Restart Sleep Timer On Keypress" + + Index: apps/settings.h =================================================================== --- apps/settings.h (revision 30842) +++ apps/settings.h (working copy) @@ -800,6 +800,7 @@ int sleeptimer_duration; bool sleeptimer_on_startup; + bool keypress_restarts_sleeptimer; #ifdef HAVE_MORSE_INPUT bool morse_input; /* text input method setting */ Index: apps/menus/main_menu.c =================================================================== --- apps/menus/main_menu.c (revision 30842) +++ apps/menus/main_menu.c (working copy) @@ -482,6 +482,8 @@ #if CONFIG_RTC == 0 MENUITEM_SETTING(sleeptimer_on_startup, &global_settings.sleeptimer_on_startup, NULL); +MENUITEM_SETTING(keypress_restarts_sleeptimer, + &global_settings.keypress_restarts_sleeptimer, NULL); #endif MENUITEM_FUNCTION(show_credits_item, 0, ID2P(LANG_CREDITS), @@ -530,7 +532,7 @@ #if CONFIG_RTC &timedate_item, #else - &sleep_timer_call, &sleeptimer_on_startup, + &sleep_timer_call, &sleeptimer_on_startup, &keypress_restarts_sleeptimer, #endif &manage_settings, ); Index: apps/menus/time_menu.c =================================================================== --- apps/menus/time_menu.c (revision 30842) +++ apps/menus/time_menu.c (working copy) @@ -138,6 +138,8 @@ #endif /* HAVE_RTC_ALARM */ MENUITEM_SETTING(sleeptimer_on_startup, &global_settings.sleeptimer_on_startup, NULL); +MENUITEM_SETTING(keypress_restarts_sleeptimer, + &global_settings.keypress_restarts_sleeptimer, NULL); static void talk_timedate(void) { @@ -244,7 +246,7 @@ &alarm_wake_up_screen, #endif #endif - &sleeptimer_on_startup, &timeformat); + &sleeptimer_on_startup, &keypress_restarts_sleeptimer, &timeformat); int time_screen(void* ignored) { Index: apps/settings_list.c =================================================================== --- apps/settings_list.c (revision 30842) +++ apps/settings_list.c (working copy) @@ -1771,6 +1771,8 @@ UNIT_MIN, 5, 300, 5, sleeptimer_formatter, NULL, NULL), OFFON_SETTING(0, sleeptimer_on_startup, LANG_SLEEP_TIMER_ON_POWER_UP, false, "sleeptimer on startup", NULL), + OFFON_SETTING(0, keypress_restarts_sleeptimer, LANG_KEYPRESS_RESTARTS_SLEEP_TIMER, false, + "keypress restarts sleeptimer", NULL), #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING CHOICE_SETTING(0, touchpad_sensitivity, LANG_TOUCHPAD_SENSITIVITY, 0, "touchpad sensitivity", "normal,high", touchpad_set_sensitivity, 2, Index: firmware/powermgmt.c =================================================================== --- firmware/powermgmt.c (revision 30842) +++ firmware/powermgmt.c (working copy) @@ -47,6 +47,7 @@ #if (CONFIG_PLATFORM & PLATFORM_HOSTED) #include #endif +#include "settings.h" #if (defined(IAUDIO_X5) || defined(IAUDIO_M5)) && !defined (SIMULATOR) #include "lcd-remote-target.h" @@ -707,6 +708,8 @@ void reset_poweroff_timer(void) { last_event_tick = current_tick; + if (sleeptimer_active && global_settings.keypress_restarts_sleeptimer) + set_sleep_timer(global_settings.sleeptimer_duration * 60); } void sys_poweroff(void) Index: manual/appendix/config_file_options.tex =================================================================== --- manual/appendix/config_file_options.tex (revision 30842) +++ manual/appendix/config_file_options.tex (working copy) @@ -107,6 +107,7 @@ sleeptimer duration & 5 to 300 (in steps of 5) & min\\ sleeptimer on startup & off, on & N/A\\ + keypress restarts sleeptimer & off, on & N/A\\ max files in playlist & 1000 - 32000 & N/A\\ max files in dir & 50 - 10000 & N/A\\ lang & /path/filename.lng & N/A\\ Index: manual/configure_rockbox/sleep_timer.tex =================================================================== --- manual/configure_rockbox/sleep_timer.tex (revision 30842) +++ manual/configure_rockbox/sleep_timer.tex (working copy) @@ -11,3 +11,6 @@ current \setting{Sleep Timer}. \item[Start Sleep Timer On Boot:] If set, a \setting{Sleep Timer} will be initiated when the device starts. +\item[Restart Sleep Timer On Keypress:] + If set, when a \setting{Sleep Timer} is active and a key is pressed, the + \setting{Sleep Timer} will be restarted with the initial duration.