diff options
author | Nick Peskett <rockbox@peskett.co.uk> | 2011-12-26 09:30:25 +0000 |
---|---|---|
committer | Nick Peskett <rockbox@peskett.co.uk> | 2011-12-26 09:30:25 +0000 |
commit | 5dba771d63b26195b24fc5bbd098aff733da2599 (patch) | |
tree | 42311b171a28178d3a55d4cab887e3a0216988cc | |
parent | 57a0ebb1645a9c28aba467ea331da0ccce173270 (diff) | |
download | rockbox-5dba771d63b26195b24fc5bbd098aff733da2599.tar.gz rockbox-5dba771d63b26195b24fc5bbd098aff733da2599.zip |
Option to restart running sleep timer on keypress.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31437 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/lang/english.lang | 14 | ||||
-rw-r--r-- | apps/menus/settings_menu.c | 5 | ||||
-rw-r--r-- | apps/settings.c | 2 | ||||
-rw-r--r-- | apps/settings.h | 1 | ||||
-rw-r--r-- | apps/settings_list.c | 2 | ||||
-rw-r--r-- | firmware/export/powermgmt.h | 1 | ||||
-rw-r--r-- | firmware/powermgmt.c | 12 | ||||
-rw-r--r-- | manual/appendix/config_file_options.tex | 1 | ||||
-rw-r--r-- | manual/configure_rockbox/startup_shutdown_options.tex | 3 |
9 files changed, 40 insertions, 1 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index c2db1e6fb2..627fda8b12 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -12979,3 +12979,17 @@ | |||
12979 | *: "Startup/Shutdown" | 12979 | *: "Startup/Shutdown" |
12980 | </voice> | 12980 | </voice> |
12981 | </phrase> | 12981 | </phrase> |
12982 | <phrase> | ||
12983 | id: LANG_KEYPRESS_RESTARTS_SLEEP_TIMER | ||
12984 | desc: whether to restart running sleep timer on keypress | ||
12985 | user: core | ||
12986 | <source> | ||
12987 | *: "Restart Sleep Timer On Keypress" | ||
12988 | </source> | ||
12989 | <dest> | ||
12990 | *: "Restart Sleep Timer On Keypress" | ||
12991 | </dest> | ||
12992 | <voice> | ||
12993 | *: "Restart Sleep Timer On Keypress" | ||
12994 | </voice> | ||
12995 | </phrase> | ||
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index cce5dd751d..659a7f2fbb 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c | |||
@@ -439,13 +439,16 @@ MENUITEM_FUNCTION_DYNTEXT(sleep_timer_call, 0, sleep_timer, NULL, | |||
439 | /* make it look like a setting to the user */ | 439 | /* make it look like a setting to the user */ |
440 | MENUITEM_SETTING(sleeptimer_on_startup, | 440 | MENUITEM_SETTING(sleeptimer_on_startup, |
441 | &global_settings.sleeptimer_on_startup, NULL); | 441 | &global_settings.sleeptimer_on_startup, NULL); |
442 | MENUITEM_SETTING(keypress_restarts_sleeptimer, | ||
443 | &global_settings.keypress_restarts_sleeptimer, NULL); | ||
442 | 444 | ||
443 | MAKE_MENU(startup_shutdown_menu, ID2P(LANG_STARTUP_SHUTDOWN), | 445 | MAKE_MENU(startup_shutdown_menu, ID2P(LANG_STARTUP_SHUTDOWN), |
444 | 0, Icon_System_menu, | 446 | 0, Icon_System_menu, |
445 | &start_screen, | 447 | &start_screen, |
446 | &poweroff, | 448 | &poweroff, |
447 | &sleep_timer_call, | 449 | &sleep_timer_call, |
448 | &sleeptimer_on_startup | 450 | &sleeptimer_on_startup, |
451 | &keypress_restarts_sleeptimer | ||
449 | ); | 452 | ); |
450 | 453 | ||
451 | /* STARTUP/SHUTDOWN MENU */ | 454 | /* STARTUP/SHUTDOWN MENU */ |
diff --git a/apps/settings.c b/apps/settings.c index 408e377e1a..39390f408e 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -844,6 +844,8 @@ void settings_apply(bool read_disk) | |||
844 | dac_line_in(global_settings.line_in); | 844 | dac_line_in(global_settings.line_in); |
845 | #endif | 845 | #endif |
846 | set_poweroff_timeout(global_settings.poweroff); | 846 | set_poweroff_timeout(global_settings.poweroff); |
847 | set_keypress_restarts_sleep_timer( | ||
848 | global_settings.keypress_restarts_sleeptimer); | ||
847 | 849 | ||
848 | #if defined(BATTERY_CAPACITY_INC) && BATTERY_CAPACITY_INC > 0 | 850 | #if defined(BATTERY_CAPACITY_INC) && BATTERY_CAPACITY_INC > 0 |
849 | /* only call if it's really exchangable */ | 851 | /* only call if it's really exchangable */ |
diff --git a/apps/settings.h b/apps/settings.h index 7047b93709..65abcc54e8 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -800,6 +800,7 @@ struct user_settings | |||
800 | 800 | ||
801 | int sleeptimer_duration; | 801 | int sleeptimer_duration; |
802 | bool sleeptimer_on_startup; | 802 | bool sleeptimer_on_startup; |
803 | bool keypress_restarts_sleeptimer; | ||
803 | 804 | ||
804 | #ifdef HAVE_MORSE_INPUT | 805 | #ifdef HAVE_MORSE_INPUT |
805 | bool morse_input; /* text input method setting */ | 806 | bool morse_input; /* text input method setting */ |
diff --git a/apps/settings_list.c b/apps/settings_list.c index 54c0917cda..614ac50712 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -1808,6 +1808,8 @@ const struct settings_list settings[] = { | |||
1808 | UNIT_MIN, 5, 300, 5, sleeptimer_formatter, NULL, NULL), | 1808 | UNIT_MIN, 5, 300, 5, sleeptimer_formatter, NULL, NULL), |
1809 | OFFON_SETTING(0, sleeptimer_on_startup, LANG_SLEEP_TIMER_ON_POWER_UP, false, | 1809 | OFFON_SETTING(0, sleeptimer_on_startup, LANG_SLEEP_TIMER_ON_POWER_UP, false, |
1810 | "sleeptimer on startup", NULL), | 1810 | "sleeptimer on startup", NULL), |
1811 | OFFON_SETTING(0, keypress_restarts_sleeptimer, LANG_KEYPRESS_RESTARTS_SLEEP_TIMER, false, | ||
1812 | "keypress restarts sleeptimer", set_keypress_restarts_sleep_timer), | ||
1811 | #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING | 1813 | #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING |
1812 | CHOICE_SETTING(0, touchpad_sensitivity, LANG_TOUCHPAD_SENSITIVITY, 0, | 1814 | CHOICE_SETTING(0, touchpad_sensitivity, LANG_TOUCHPAD_SENSITIVITY, 0, |
1813 | "touchpad sensitivity", "normal,high", touchpad_set_sensitivity, 2, | 1815 | "touchpad sensitivity", "normal,high", touchpad_set_sensitivity, 2, |
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index 808c8586d8..d54f1d5a18 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h | |||
@@ -164,6 +164,7 @@ void set_battery_type(int type); /* set local battery type */ | |||
164 | 164 | ||
165 | void set_sleep_timer(int seconds); | 165 | void set_sleep_timer(int seconds); |
166 | int get_sleep_timer(void); | 166 | int get_sleep_timer(void); |
167 | void set_keypress_restarts_sleep_timer(bool enable); | ||
167 | void handle_auto_poweroff(void); | 168 | void handle_auto_poweroff(void); |
168 | void set_car_adapter_mode(bool setting); | 169 | void set_car_adapter_mode(bool setting); |
169 | void reset_poweroff_timer(void); | 170 | void reset_poweroff_timer(void); |
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 76322d65a3..4d554d6d3c 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -64,6 +64,10 @@ void send_battery_level_event(void); | |||
64 | 64 | ||
65 | static bool sleeptimer_active = false; | 65 | static bool sleeptimer_active = false; |
66 | static long sleeptimer_endtick; | 66 | static long sleeptimer_endtick; |
67 | /* Whether an active sleep timer should be restarted when a key is pressed */ | ||
68 | static bool sleeptimer_key_restarts = false; | ||
69 | /* The number of seconds the sleep timer was last set to */ | ||
70 | static unsigned int sleeptimer_duration = 0; | ||
67 | 71 | ||
68 | #if CONFIG_CHARGING | 72 | #if CONFIG_CHARGING |
69 | /* State of the charger input as seen by the power thread */ | 73 | /* State of the charger input as seen by the power thread */ |
@@ -707,6 +711,8 @@ void set_poweroff_timeout(int timeout) | |||
707 | void reset_poweroff_timer(void) | 711 | void reset_poweroff_timer(void) |
708 | { | 712 | { |
709 | last_event_tick = current_tick; | 713 | last_event_tick = current_tick; |
714 | if (sleeptimer_active && sleeptimer_key_restarts) | ||
715 | set_sleep_timer(sleeptimer_duration); | ||
710 | } | 716 | } |
711 | 717 | ||
712 | void sys_poweroff(void) | 718 | void sys_poweroff(void) |
@@ -777,6 +783,7 @@ void set_sleep_timer(int seconds) | |||
777 | sleeptimer_active = false; | 783 | sleeptimer_active = false; |
778 | sleeptimer_endtick = 0; | 784 | sleeptimer_endtick = 0; |
779 | } | 785 | } |
786 | sleeptimer_duration = seconds; | ||
780 | } | 787 | } |
781 | 788 | ||
782 | int get_sleep_timer(void) | 789 | int get_sleep_timer(void) |
@@ -787,6 +794,11 @@ int get_sleep_timer(void) | |||
787 | return 0; | 794 | return 0; |
788 | } | 795 | } |
789 | 796 | ||
797 | void set_keypress_restarts_sleep_timer(bool enable) | ||
798 | { | ||
799 | sleeptimer_key_restarts = enable; | ||
800 | } | ||
801 | |||
790 | static void handle_sleep_timer(void) | 802 | static void handle_sleep_timer(void) |
791 | { | 803 | { |
792 | #ifndef BOOTLOADER | 804 | #ifndef BOOTLOADER |
diff --git a/manual/appendix/config_file_options.tex b/manual/appendix/config_file_options.tex index d237182c25..3db416ecfa 100644 --- a/manual/appendix/config_file_options.tex +++ b/manual/appendix/config_file_options.tex | |||
@@ -107,6 +107,7 @@ | |||
107 | sleeptimer duration & 5 to 300 (in steps of 5) | 107 | sleeptimer duration & 5 to 300 (in steps of 5) |
108 | & min\\ | 108 | & min\\ |
109 | sleeptimer on startup & off, on & N/A\\ | 109 | sleeptimer on startup & off, on & N/A\\ |
110 | keypress restarts sleeptimer & off, on & N/A\\ | ||
110 | max files in playlist & 1000 - 32000 & N/A\\ | 111 | max files in playlist & 1000 - 32000 & N/A\\ |
111 | max files in dir & 50 - 10000 & N/A\\ | 112 | max files in dir & 50 - 10000 & N/A\\ |
112 | lang & /path/filename.lng & N/A\\ | 113 | lang & /path/filename.lng & N/A\\ |
diff --git a/manual/configure_rockbox/startup_shutdown_options.tex b/manual/configure_rockbox/startup_shutdown_options.tex index 2fb4c4881a..ef84358af7 100644 --- a/manual/configure_rockbox/startup_shutdown_options.tex +++ b/manual/configure_rockbox/startup_shutdown_options.tex | |||
@@ -54,4 +54,7 @@ are run at startup, or initiate a shutdown when conditions are met. | |||
54 | \item[Start Sleep Timer On Boot:] | 54 | \item[Start Sleep Timer On Boot:] |
55 | If set, a \setting{Sleep Timer} will be initiated when the device | 55 | If set, a \setting{Sleep Timer} will be initiated when the device |
56 | starts. | 56 | starts. |
57 | \item[Restart Sleep Timer On Keypress:] | ||
58 | If set, when a \setting{Sleep Timer} is active and a key is pressed, the | ||
59 | \setting{Sleep Timer} will be restarted with the initial duration. | ||
57 | \end{description} | 60 | \end{description} |