Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang (revision 23621)
+++ apps/lang/english.lang (working copy)
@@ -4625,6 +4625,20 @@
+ id: LANG_PERMASLEEP_TIMER
+ desc: permanent sleep timer setting
+ user: core
+
+ *: "Permanent Sleep Timer"
+
+
+ *: "Permanent Sleep Timer"
+
+
+ *: "Permanent Sleep Timer"
+
+
+
id: LANG_LIMITS_MENU
desc: in the system sub menu
user: core
Index: apps/settings.h
===================================================================
--- apps/settings.h (revision 23621)
+++ apps/settings.h (working copy)
@@ -803,6 +803,8 @@
int compressor_release_time;
#endif
+ int permasleep_timer;
+
#ifdef HAVE_MORSE_INPUT
bool morse_input; /* text input method setting */
#endif
Index: apps/menus/time_menu.c
===================================================================
--- apps/menus/time_menu.c (revision 23621)
+++ apps/menus/time_menu.c (working copy)
@@ -85,6 +85,8 @@
/* in main_menu.c */
extern const struct menu_item_ex sleep_timer_call;
+MENUITEM_SETTING(permasleep_timer_call, &global_settings.permasleep_timer, NULL);
+
#ifdef HAVE_RTC_ALARM
MENUITEM_FUNCTION(alarm_screen_call, 0, ID2P(LANG_ALARM_MOD_ALARM_MENU),
(menu_function)alarm_screen, NULL, NULL, Icon_NOICON);
@@ -240,7 +242,7 @@
MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), time_menu_callback, Icon_NOICON,
- &time_set, &sleep_timer_call,
+ &time_set, &sleep_timer_call, &permasleep_timer_call,
#ifdef HAVE_RTC_ALARM
&alarm_screen_call,
#if defined(HAVE_RECORDING) || CONFIG_TUNER
Index: apps/menus/main_menu.c
===================================================================
--- apps/menus/main_menu.c (revision 23621)
+++ apps/menus/main_menu.c (working copy)
@@ -384,7 +384,7 @@
/* sleep Menu */
-static const char* sleep_timer_formatter(char* buffer, size_t buffer_size,
+const char* sleep_timer_formatter(char* buffer, size_t buffer_size,
int value, const char* unit)
{
(void) unit;
@@ -429,6 +429,12 @@
(menu_function)view_runtime, NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(debug_menu_item, 0, ID2P(LANG_DEBUG),
(menu_function)debug_menu, NULL, NULL, Icon_NOICON);
+
+/* Needs to be here as well as time_menu.c as MENUITEM_SETTING
+(unlike MENUITEM_FUNCTION) is defined as static */
+#if CONFIG_RTC == 0
+MENUITEM_SETTING(permasleep_timer_call, &global_settings.permasleep_timer, NULL);
+#endif
MAKE_MENU(info_menu, ID2P(LANG_SYSTEM), 0, Icon_System_menu,
#if CONFIG_RTC
@@ -436,7 +442,7 @@
#endif
&show_info_item, &show_credits_item, &show_runtime_item,
#if CONFIG_RTC == 0
- &sleep_timer_call,
+ &sleep_timer_call, &permasleep_timer_call,
#endif
&debug_menu_item);
/* INFO MENU */
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c (revision 23621)
+++ apps/settings_list.c (working copy)
@@ -340,6 +340,15 @@
}
#endif
+extern const char* sleep_timer_formatter(char* buffer, size_t buffer_size,
+ int value, const char* unit);
+extern void set_sleep_timer(int seconds);
+static void permasleep_timer_cb(int minutes)
+{
+ (void) minutes;
+ set_sleep_timer(global_settings.permasleep_timer * 60);
+}
+
#ifndef HAVE_WHEEL_ACCELERATION
static const char* scanaccel_formatter(char *buffer, size_t buffer_size,
int val, const char *unit)
@@ -1561,6 +1570,9 @@
#endif /* CONFIG_CODEC == SWCODEC */
TEXT_SETTING(0, playlist_catalog_dir, "playlist catalog directory",
PLAYLIST_CATALOG_DEFAULT_DIR, NULL, NULL),
+ INT_SETTING(0, permasleep_timer, LANG_PERMASLEEP_TIMER, 0, "permasleep timer",
+ UNIT_MIN, 300, 0, -5, sleep_timer_formatter, NULL,
+ &permasleep_timer_cb),
#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
CHOICE_SETTING(0, touchpad_sensitivity, LANG_TOUCHPAD_SENSITIVITY, 0,
"touchpad sensitivity", "normal,high", touchpad_set_sensitivity, 2,
Index: apps/root_menu.c
===================================================================
--- apps/root_menu.c (revision 23621)
+++ apps/root_menu.c (working copy)
@@ -549,6 +549,10 @@
next_screen = GO_TO_ROOT;
#endif
+ if (global_settings.permasleep_timer) {
+ set_sleep_timer(global_settings.permasleep_timer * 60);
+ }
+
while (true)
{
switch (next_screen)