Option to restart running sleep timer on keypress.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31437 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
57a0ebb164
commit
5dba771d63
9 changed files with 40 additions and 1 deletions
|
@ -12979,3 +12979,17 @@
|
|||
*: "Startup/Shutdown"
|
||||
</voice>
|
||||
</phrase>
|
||||
<phrase>
|
||||
id: LANG_KEYPRESS_RESTARTS_SLEEP_TIMER
|
||||
desc: whether to restart running sleep timer on keypress
|
||||
user: core
|
||||
<source>
|
||||
*: "Restart Sleep Timer On Keypress"
|
||||
</source>
|
||||
<dest>
|
||||
*: "Restart Sleep Timer On Keypress"
|
||||
</dest>
|
||||
<voice>
|
||||
*: "Restart Sleep Timer On Keypress"
|
||||
</voice>
|
||||
</phrase>
|
||||
|
|
|
@ -439,13 +439,16 @@ MENUITEM_FUNCTION_DYNTEXT(sleep_timer_call, 0, sleep_timer, NULL,
|
|||
/* make it look like a setting to the user */
|
||||
MENUITEM_SETTING(sleeptimer_on_startup,
|
||||
&global_settings.sleeptimer_on_startup, NULL);
|
||||
MENUITEM_SETTING(keypress_restarts_sleeptimer,
|
||||
&global_settings.keypress_restarts_sleeptimer, NULL);
|
||||
|
||||
MAKE_MENU(startup_shutdown_menu, ID2P(LANG_STARTUP_SHUTDOWN),
|
||||
0, Icon_System_menu,
|
||||
&start_screen,
|
||||
&poweroff,
|
||||
&sleep_timer_call,
|
||||
&sleeptimer_on_startup
|
||||
&sleeptimer_on_startup,
|
||||
&keypress_restarts_sleeptimer
|
||||
);
|
||||
|
||||
/* STARTUP/SHUTDOWN MENU */
|
||||
|
|
|
@ -844,6 +844,8 @@ void settings_apply(bool read_disk)
|
|||
dac_line_in(global_settings.line_in);
|
||||
#endif
|
||||
set_poweroff_timeout(global_settings.poweroff);
|
||||
set_keypress_restarts_sleep_timer(
|
||||
global_settings.keypress_restarts_sleeptimer);
|
||||
|
||||
#if defined(BATTERY_CAPACITY_INC) && BATTERY_CAPACITY_INC > 0
|
||||
/* only call if it's really exchangable */
|
||||
|
|
|
@ -800,6 +800,7 @@ struct user_settings
|
|||
|
||||
int sleeptimer_duration;
|
||||
bool sleeptimer_on_startup;
|
||||
bool keypress_restarts_sleeptimer;
|
||||
|
||||
#ifdef HAVE_MORSE_INPUT
|
||||
bool morse_input; /* text input method setting */
|
||||
|
|
|
@ -1808,6 +1808,8 @@ const struct settings_list settings[] = {
|
|||
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", set_keypress_restarts_sleep_timer),
|
||||
#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
|
||||
CHOICE_SETTING(0, touchpad_sensitivity, LANG_TOUCHPAD_SENSITIVITY, 0,
|
||||
"touchpad sensitivity", "normal,high", touchpad_set_sensitivity, 2,
|
||||
|
|
|
@ -164,6 +164,7 @@ void set_battery_type(int type); /* set local battery type */
|
|||
|
||||
void set_sleep_timer(int seconds);
|
||||
int get_sleep_timer(void);
|
||||
void set_keypress_restarts_sleep_timer(bool enable);
|
||||
void handle_auto_poweroff(void);
|
||||
void set_car_adapter_mode(bool setting);
|
||||
void reset_poweroff_timer(void);
|
||||
|
|
|
@ -64,6 +64,10 @@ void send_battery_level_event(void);
|
|||
|
||||
static bool sleeptimer_active = false;
|
||||
static long sleeptimer_endtick;
|
||||
/* Whether an active sleep timer should be restarted when a key is pressed */
|
||||
static bool sleeptimer_key_restarts = false;
|
||||
/* The number of seconds the sleep timer was last set to */
|
||||
static unsigned int sleeptimer_duration = 0;
|
||||
|
||||
#if CONFIG_CHARGING
|
||||
/* State of the charger input as seen by the power thread */
|
||||
|
@ -707,6 +711,8 @@ void set_poweroff_timeout(int timeout)
|
|||
void reset_poweroff_timer(void)
|
||||
{
|
||||
last_event_tick = current_tick;
|
||||
if (sleeptimer_active && sleeptimer_key_restarts)
|
||||
set_sleep_timer(sleeptimer_duration);
|
||||
}
|
||||
|
||||
void sys_poweroff(void)
|
||||
|
@ -777,6 +783,7 @@ void set_sleep_timer(int seconds)
|
|||
sleeptimer_active = false;
|
||||
sleeptimer_endtick = 0;
|
||||
}
|
||||
sleeptimer_duration = seconds;
|
||||
}
|
||||
|
||||
int get_sleep_timer(void)
|
||||
|
@ -787,6 +794,11 @@ int get_sleep_timer(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void set_keypress_restarts_sleep_timer(bool enable)
|
||||
{
|
||||
sleeptimer_key_restarts = enable;
|
||||
}
|
||||
|
||||
static void handle_sleep_timer(void)
|
||||
{
|
||||
#ifndef BOOTLOADER
|
||||
|
|
|
@ -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\\
|
||||
|
|
|
@ -54,4 +54,7 @@ are run at startup, or initiate a shutdown when conditions are met.
|
|||
\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.
|
||||
\end{description}
|
||||
|
|
Loading…
Reference in a new issue