From ed37c2e8948960b45c9bac58f1ffb678fdf31f5d Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Tue, 15 Mar 2022 17:12:40 -0400 Subject: [PATCH] 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 --- apps/features.txt | 6 ++++++ apps/lang/english.lang | 17 ++++++++++++++++ apps/main.c | 20 ++++++++++--------- apps/menus/settings_menu.c | 14 ++++++++++++- apps/settings.h | 5 +++++ apps/settings_list.c | 6 ++++++ manual/appendix/config_file_options.tex | 5 ++++- .../startup_shutdown_options.tex | 13 ++++++++++++ 8 files changed, 75 insertions(+), 11 deletions(-) diff --git a/apps/features.txt b/apps/features.txt index 45e06e5e64..da2064ab2f 100644 --- a/apps/features.txt +++ b/apps/features.txt @@ -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 diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 3b505bb9a2..f4571aa6bc 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -16368,3 +16368,20 @@ *: "Keep Current Track When Replacing Playlist" + + id: LANG_CLEAR_SETTINGS_ON_HOLD + desc: in the system sub menu + user: core + + *: none + clear_settings_on_hold, ipod4g, iriverh10: "Clear settings when hold switch is on during startup" + + + *: none + clear_settings_on_hold, ipod4g, iriverh10: "Clear settings when hold switch is on during startup" + + + *: none + clear_settings_on_hold, ipod4g, iriverh10: "Clear settings when hold switch is on during startup" + + diff --git a/apps/main.c b/apps/main.c index dff9dc5778..d52c17a67e 100644 --- a/apps/main.c +++ b/apps/main.c @@ -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)"); - settings_load(SETTINGS_ALL); - CHART("init_dircache(true)"); diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 2539f17860..60f206c86f 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -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 */ diff --git a/apps/settings.h b/apps/settings.h index 9af8e27e5e..ae9b6f31ce 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -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 **/ diff --git a/apps/settings_list.c b/apps/settings_list.c index 0e39a58b1a..e230a5a081 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -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); diff --git a/manual/appendix/config_file_options.tex b/manual/appendix/config_file_options.tex index b188c953f8..9de95c257b 100644 --- a/manual/appendix/config_file_options.tex +++ b/manual/appendix/config_file_options.tex @@ -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} diff --git a/manual/configure_rockbox/startup_shutdown_options.tex b/manual/configure_rockbox/startup_shutdown_options.tex index 7952985ece..9bc85d6be8 100644 --- a/manual/configure_rockbox/startup_shutdown_options.tex +++ b/manual/configure_rockbox/startup_shutdown_options.tex @@ -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