FS#13193 - Add option to disable settings reset on startup

Updated version of the patch originally by user cockroach

UNTESTED
Ipods?, Iriver H10,
I do not own these players so YMMV

https://www.rockbox.org/tracker/task/13193

Change-Id: I7924837f582cc5c49ee68c186d6822f577f65147
This commit is contained in:
William Wilgus 2022-03-15 17:12:40 -04:00
parent 58bf7c7e6f
commit ed37c2e894
8 changed files with 75 additions and 11 deletions

View file

@ -289,3 +289,9 @@ multi_boot
#if defined(HIBY_LINUX)
hibylinux
#endif
#if defined(SETTINGS_RESET) || \
(CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IRIVER_H10_PAD)
clear_settings_on_hold
#endif

View file

@ -16368,3 +16368,20 @@
*: "Keep Current Track When Replacing Playlist"
</voice>
</phrase>
<phrase>
id: LANG_CLEAR_SETTINGS_ON_HOLD
desc: in the system sub menu
user: core
<source>
*: none
clear_settings_on_hold, ipod4g, iriverh10: "Clear settings when hold switch is on during startup"
</source>
<dest>
*: none
clear_settings_on_hold, ipod4g, iriverh10: "Clear settings when hold switch is on during startup"
</dest>
<voice>
*: none
clear_settings_on_hold, ipod4g, iriverh10: "Clear settings when hold switch is on during startup"
</voice>
</phrase>

View file

@ -566,7 +566,12 @@ static void init(void)
pcm_init();
dsp_init();
#if defined(SETTINGS_RESET) || (CONFIG_KEYPAD == IPOD_4G_PAD) || \
CHART(">settings_load(ALL)");
settings_load(SETTINGS_ALL);
CHART("<settings_load(ALL)");
#if defined(SETTINGS_RESET) || \
(CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IRIVER_H10_PAD)
#ifdef SETTINGS_RESET
/* Reset settings if holding the reset button. (Rec on Archos,
@ -577,16 +582,13 @@ static void init(void)
if (button_hold())
#endif
{
splash(HZ*2, str(LANG_RESET_DONE_CLEAR));
settings_reset();
if (global_settings.clear_settings_on_hold)
{
splash(HZ*2, str(LANG_RESET_DONE_CLEAR));
settings_reset();
}
}
else
#endif
{
CHART(">settings_load(ALL)");
settings_load(SETTINGS_ALL);
CHART("<settings_load(ALL)");
}
#ifdef HAVE_DIRCACHE
CHART(">init_dircache(true)");

View file

@ -584,6 +584,14 @@ MENUITEM_SETTING(keypress_restarts_sleeptimer,
&global_settings.keypress_restarts_sleeptimer, NULL);
MENUITEM_SETTING(show_shutdown_message, &global_settings.show_shutdown_message, NULL);
#if defined(SETTINGS_RESET) || \
(CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IRIVER_H10_PAD)
#define SETTINGS_CLEAR_ON_HOLD
MENUITEM_SETTING(clear_settings_on_hold,
&global_settings.clear_settings_on_hold, NULL);
#endif
MAKE_MENU(startup_shutdown_menu, ID2P(LANG_STARTUP_SHUTDOWN),
0, Icon_System_menu,
&show_shutdown_message,
@ -592,7 +600,11 @@ MAKE_MENU(startup_shutdown_menu, ID2P(LANG_STARTUP_SHUTDOWN),
&sleeptimer_toggle,
&sleeptimer_duration,
&sleeptimer_on_startup,
&keypress_restarts_sleeptimer
&keypress_restarts_sleeptimer,
#if defined(SETTINGS_CLEAR_ON_HOLD)
&clear_settings_on_hold,
#undef SETTINGS_CLEAR_ON_HOLD
#endif
);
/* STARTUP/SHUTDOWN MENU */

View file

@ -868,6 +868,11 @@ struct user_settings
#if defined(DX50) || defined(DX90) || (defined(HAVE_USB_POWER) && !defined(USB_NONE) && !defined(SIMULATOR))
int usb_mode;
#endif
#if defined(SETTINGS_RESET) || \
(CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IRIVER_H10_PAD)
bool clear_settings_on_hold;
#endif
};
/** global variables **/

View file

@ -2168,6 +2168,12 @@ const struct settings_list settings[] = {
#endif
),
#endif
#if defined(SETTINGS_RESET) || \
(CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IRIVER_H10_PAD)
OFFON_SETTING(0, clear_settings_on_hold, LANG_CLEAR_SETTINGS_ON_HOLD,
true, "clear settings on hold", NULL),
#endif
};
const int nb_settings = sizeof(settings)/sizeof(*settings);

View file

@ -374,7 +374,10 @@
sync RDS time
& off, on & N/A\\
}%
\opt{clear_settings_on_hold}{
clear settings on hold
& off, on & N/A\\
}%
\bottomrule
\end{longtable}
\end{center}

View file

@ -36,6 +36,19 @@ are run at startup, or initiate a shutdown when conditions are met.
to be enabled.
\end{description}
\opt{clear_settings_on_hold}{
\subsection{\label{ref:ClearOnHold}Hold switch clears settings on startup }
This option controls whether Rockbox clears its configuration if the hold
switch is enabled during startup.
\begin{description}
\item[Yes.]
Clear the settings if the hold switch is enabled during startup.
\item[No.]
Do not clear the settings, regardless of the hold switch's position.
\end{description}
}
\subsection{\label{ref:IdlePoweroffSetting}Idle Poweroff}
Rockbox can be configured to turn off power after the unit has been idle for
a defined number of minutes. The \dap{} is idle when playback is stopped or