Reset settings on button hold

extend this properly to the gigabeast and iriver
updated manual entries

Change-Id: Ibd1bce8d113193cb3b76f4daf0d6ceb01a2f7585
This commit is contained in:
William Wilgus 2022-06-20 22:37:09 -04:00 committed by William Wilgus
parent e75e07e1b6
commit 8283752223
7 changed files with 64 additions and 25 deletions

View file

@ -290,7 +290,8 @@ multi_boot
hibylinux hibylinux
#endif #endif
#if defined(SETTINGS_RESET) || \ #if defined(BUTTON_REC) || \
(CONFIG_KEYPAD == GIGABEAT_PAD) || \
(CONFIG_KEYPAD == IPOD_4G_PAD) || \ (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IRIVER_H10_PAD) (CONFIG_KEYPAD == IRIVER_H10_PAD)
clear_settings_on_hold clear_settings_on_hold

View file

@ -16374,14 +16374,21 @@
user: core user: core
<source> <source>
*: none *: none
clear_settings_on_hold, ipod4g, iriverh10: "Clear settings when hold switch is on during startup" ipod3g: none
ipod*: "Clear settings when hold switch is on during startup"
clear_settings_on_hold, iriverh10: "Clear settings when reset button is held during startup"
</source> </source>
<dest> <dest>
*: none *: none
clear_settings_on_hold, ipod4g, iriverh10: "Clear settings when hold switch is on during startup" ipod3g: none
ipod*: "Clear settings when hold switch is on during startup"
clear_settings_on_hold, iriverh10: "Clear settings when reset button is held during startup"
</dest> </dest>
<voice> <voice>
*: none *: none
clear_settings_on_hold, ipod4g, iriverh10: "Clear settings when hold switch is on during startup" ipod3g: none
ipod*: "Clear settings when hold switch is on during startup"
clear_settings_on_hold, iriverh10: "Clear settings when reset button is held during startup"
</voice> </voice>
</phrase> </phrase>

View file

@ -570,16 +570,18 @@ static void init(void)
settings_load(SETTINGS_ALL); settings_load(SETTINGS_ALL);
CHART("<settings_load(ALL)"); CHART("<settings_load(ALL)");
#if defined(SETTINGS_RESET) || \ #if defined(BUTTON_REC) || \
(CONFIG_KEYPAD == GIGABEAT_PAD) || \
(CONFIG_KEYPAD == IPOD_4G_PAD) || \ (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IRIVER_H10_PAD) (CONFIG_KEYPAD == IRIVER_H10_PAD)
if (global_settings.clear_settings_on_hold &&
#ifdef SETTINGS_RESET #ifdef SETTINGS_RESET
/* Reset settings if holding the reset button. (Rec on Archos, /* Reset settings if holding the reset button. (Rec on Archos,
A on Gigabeat) */ A on Gigabeat) */
if ((button_status() & SETTINGS_RESET) == SETTINGS_RESET) ((button_status() & SETTINGS_RESET) == SETTINGS_RESET))
#else #else
/* Reset settings if the hold button is turned on */ /* Reset settings if the hold button is turned on */
if (global_settings.clear_settings_on_hold && button_hold()) (button_hold()))
#endif #endif
{ {
splash(HZ*2, str(LANG_RESET_DONE_CLEAR)); splash(HZ*2, str(LANG_RESET_DONE_CLEAR));

View file

@ -584,9 +584,10 @@ MENUITEM_SETTING(keypress_restarts_sleeptimer,
&global_settings.keypress_restarts_sleeptimer, NULL); &global_settings.keypress_restarts_sleeptimer, NULL);
MENUITEM_SETTING(show_shutdown_message, &global_settings.show_shutdown_message, NULL); MENUITEM_SETTING(show_shutdown_message, &global_settings.show_shutdown_message, NULL);
#if defined(SETTINGS_RESET) || \ #if defined(BUTTON_REC) || \
(CONFIG_KEYPAD == IPOD_4G_PAD) || \ (CONFIG_KEYPAD == GIGABEAT_PAD) || \
(CONFIG_KEYPAD == IRIVER_H10_PAD) (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IRIVER_H10_PAD)
#define SETTINGS_CLEAR_ON_HOLD #define SETTINGS_CLEAR_ON_HOLD
MENUITEM_SETTING(clear_settings_on_hold, MENUITEM_SETTING(clear_settings_on_hold,
&global_settings.clear_settings_on_hold, NULL); &global_settings.clear_settings_on_hold, NULL);

View file

@ -868,9 +868,10 @@ struct user_settings
#if defined(DX50) || defined(DX90) || (defined(HAVE_USB_POWER) && !defined(USB_NONE) && !defined(SIMULATOR)) #if defined(DX50) || defined(DX90) || (defined(HAVE_USB_POWER) && !defined(USB_NONE) && !defined(SIMULATOR))
int usb_mode; int usb_mode;
#endif #endif
#if defined(SETTINGS_RESET) || \ #if defined(BUTTON_REC) || \
(CONFIG_KEYPAD == IPOD_4G_PAD) || \ (CONFIG_KEYPAD == GIGABEAT_PAD) || \
(CONFIG_KEYPAD == IRIVER_H10_PAD) (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IRIVER_H10_PAD)
bool clear_settings_on_hold; bool clear_settings_on_hold;
#endif #endif
}; };

View file

@ -2167,9 +2167,10 @@ const struct settings_list settings[] = {
#endif #endif
), ),
#endif #endif
#if defined(SETTINGS_RESET) || \ #if defined(BUTTON_REC) || \
(CONFIG_KEYPAD == IPOD_4G_PAD) || \ (CONFIG_KEYPAD == GIGABEAT_PAD) || \
(CONFIG_KEYPAD == IRIVER_H10_PAD) (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IRIVER_H10_PAD)
OFFON_SETTING(0, clear_settings_on_hold, LANG_CLEAR_SETTINGS_ON_HOLD, OFFON_SETTING(0, clear_settings_on_hold, LANG_CLEAR_SETTINGS_ON_HOLD,
true, "clear settings on hold", NULL), true, "clear settings on hold", NULL),
#endif #endif

View file

@ -37,16 +37,42 @@ are run at startup, or initiate a shutdown when conditions are met.
\end{description} \end{description}
\opt{clear_settings_on_hold}{ \opt{clear_settings_on_hold}{
\subsection{\label{ref:ClearOnHold}Hold switch clears settings on startup } \opt{ipod}{
This option controls whether Rockbox clears its configuration if the hold \subsection{\label{ref:ClearOnHold}Hold switch clears settings on startup }
switch is enabled during startup. This option controls whether Rockbox clears its configuration if the hold
switch is enabled during startup.
\begin{description} \begin{description}
\item[Yes.] \item[Yes.]
Clear the settings if the hold switch is enabled during startup. Clear the settings if the hold switch is enabled during startup.
\item[No.] \item[No.]
Do not clear the settings, regardless of the hold switch's position. Do not clear the settings, regardless of the hold switch's position.
\end{description} \end{description}
}
\nopt{ipod}{
\opt{GIGABEAT_S_PAD}{
\subsection{\label{ref:ClearOnHold}BUTTON A clears settings on startup }
This option controls whether Rockbox clears its configuration if BUTTON_A
is held during startup.
\begin{description}
\item[Yes.]
Clear the settings if the BUTTON A is held.
\item[No.]
Do not clear the settings, regardless of BUTTON A.
\end{description}
}
\nopt{GIGABEAT_S_PAD}{
\subsection{\label{ref:ClearOnHold}BUTTON REC clears settings on startup }
This option controls whether Rockbox clears its configuration if BUTTON REC
is held during startup.
\begin{description}
\item[Yes.]
Clear the settings if the BUTTON REC is held.
\item[No.]
Do not clear the settings, regardless of BUTTON REC.
\end{description}
}
}
} }
\subsection{\label{ref:IdlePoweroffSetting}Idle Poweroff} \subsection{\label{ref:IdlePoweroffSetting}Idle Poweroff}