summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-03-15 17:12:40 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2022-06-20 18:57:25 -0400
commited37c2e8948960b45c9bac58f1ffb678fdf31f5d (patch)
tree8eeda559c74a45e21eb112e75fcd7e62c788a18e
parent58bf7c7e6fc9d94cbf1dacf3bd6b889fc4844895 (diff)
downloadrockbox-ed37c2e8948960b45c9bac58f1ffb678fdf31f5d.tar.gz
rockbox-ed37c2e8948960b45c9bac58f1ffb678fdf31f5d.zip
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
-rw-r--r--apps/features.txt6
-rw-r--r--apps/lang/english.lang17
-rw-r--r--apps/main.c20
-rw-r--r--apps/menus/settings_menu.c14
-rw-r--r--apps/settings.h5
-rw-r--r--apps/settings_list.c6
-rw-r--r--manual/appendix/config_file_options.tex5
-rw-r--r--manual/configure_rockbox/startup_shutdown_options.tex13
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
289#if defined(HIBY_LINUX) 289#if defined(HIBY_LINUX)
290hibylinux 290hibylinux
291#endif 291#endif
292
293#if defined(SETTINGS_RESET) || \
294 (CONFIG_KEYPAD == IPOD_4G_PAD) || \
295 (CONFIG_KEYPAD == IRIVER_H10_PAD)
296clear_settings_on_hold
297#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 @@
16368 *: "Keep Current Track When Replacing Playlist" 16368 *: "Keep Current Track When Replacing Playlist"
16369 </voice> 16369 </voice>
16370</phrase> 16370</phrase>
16371<phrase>
16372 id: LANG_CLEAR_SETTINGS_ON_HOLD
16373 desc: in the system sub menu
16374 user: core
16375 <source>
16376 *: none
16377 clear_settings_on_hold, ipod4g, iriverh10: "Clear settings when hold switch is on during startup"
16378 </source>
16379 <dest>
16380 *: none
16381 clear_settings_on_hold, ipod4g, iriverh10: "Clear settings when hold switch is on during startup"
16382 </dest>
16383 <voice>
16384 *: none
16385 clear_settings_on_hold, ipod4g, iriverh10: "Clear settings when hold switch is on during startup"
16386 </voice>
16387</phrase>
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)
566 pcm_init(); 566 pcm_init();
567 dsp_init(); 567 dsp_init();
568 568
569#if defined(SETTINGS_RESET) || (CONFIG_KEYPAD == IPOD_4G_PAD) || \ 569 CHART(">settings_load(ALL)");
570 settings_load(SETTINGS_ALL);
571 CHART("<settings_load(ALL)");
572
573#if defined(SETTINGS_RESET) || \
574 (CONFIG_KEYPAD == IPOD_4G_PAD) || \
570 (CONFIG_KEYPAD == IRIVER_H10_PAD) 575 (CONFIG_KEYPAD == IRIVER_H10_PAD)
571#ifdef SETTINGS_RESET 576#ifdef SETTINGS_RESET
572 /* Reset settings if holding the reset button. (Rec on Archos, 577 /* Reset settings if holding the reset button. (Rec on Archos,
@@ -577,16 +582,13 @@ static void init(void)
577 if (button_hold()) 582 if (button_hold())
578#endif 583#endif
579 { 584 {
580 splash(HZ*2, str(LANG_RESET_DONE_CLEAR)); 585 if (global_settings.clear_settings_on_hold)
581 settings_reset(); 586 {
587 splash(HZ*2, str(LANG_RESET_DONE_CLEAR));
588 settings_reset();
589 }
582 } 590 }
583 else
584#endif 591#endif
585 {
586 CHART(">settings_load(ALL)");
587 settings_load(SETTINGS_ALL);
588 CHART("<settings_load(ALL)");
589 }
590 592
591#ifdef HAVE_DIRCACHE 593#ifdef HAVE_DIRCACHE
592 CHART(">init_dircache(true)"); 594 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,
584 &global_settings.keypress_restarts_sleeptimer, NULL); 584 &global_settings.keypress_restarts_sleeptimer, NULL);
585MENUITEM_SETTING(show_shutdown_message, &global_settings.show_shutdown_message, NULL); 585MENUITEM_SETTING(show_shutdown_message, &global_settings.show_shutdown_message, NULL);
586 586
587#if defined(SETTINGS_RESET) || \
588 (CONFIG_KEYPAD == IPOD_4G_PAD) || \
589 (CONFIG_KEYPAD == IRIVER_H10_PAD)
590#define SETTINGS_CLEAR_ON_HOLD
591MENUITEM_SETTING(clear_settings_on_hold,
592 &global_settings.clear_settings_on_hold, NULL);
593#endif
594
587MAKE_MENU(startup_shutdown_menu, ID2P(LANG_STARTUP_SHUTDOWN), 595MAKE_MENU(startup_shutdown_menu, ID2P(LANG_STARTUP_SHUTDOWN),
588 0, Icon_System_menu, 596 0, Icon_System_menu,
589 &show_shutdown_message, 597 &show_shutdown_message,
@@ -592,7 +600,11 @@ MAKE_MENU(startup_shutdown_menu, ID2P(LANG_STARTUP_SHUTDOWN),
592 &sleeptimer_toggle, 600 &sleeptimer_toggle,
593 &sleeptimer_duration, 601 &sleeptimer_duration,
594 &sleeptimer_on_startup, 602 &sleeptimer_on_startup,
595 &keypress_restarts_sleeptimer 603 &keypress_restarts_sleeptimer,
604#if defined(SETTINGS_CLEAR_ON_HOLD)
605 &clear_settings_on_hold,
606#undef SETTINGS_CLEAR_ON_HOLD
607#endif
596 ); 608 );
597 609
598/* STARTUP/SHUTDOWN MENU */ 610/* 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
868#if defined(DX50) || defined(DX90) || (defined(HAVE_USB_POWER) && !defined(USB_NONE) && !defined(SIMULATOR)) 868#if defined(DX50) || defined(DX90) || (defined(HAVE_USB_POWER) && !defined(USB_NONE) && !defined(SIMULATOR))
869 int usb_mode; 869 int usb_mode;
870#endif 870#endif
871#if defined(SETTINGS_RESET) || \
872 (CONFIG_KEYPAD == IPOD_4G_PAD) || \
873 (CONFIG_KEYPAD == IRIVER_H10_PAD)
874 bool clear_settings_on_hold;
875#endif
871}; 876};
872 877
873/** global variables **/ 878/** 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[] = {
2168#endif 2168#endif
2169 ), 2169 ),
2170#endif 2170#endif
2171#if defined(SETTINGS_RESET) || \
2172 (CONFIG_KEYPAD == IPOD_4G_PAD) || \
2173 (CONFIG_KEYPAD == IRIVER_H10_PAD)
2174 OFFON_SETTING(0, clear_settings_on_hold, LANG_CLEAR_SETTINGS_ON_HOLD,
2175 true, "clear settings on hold", NULL),
2176#endif
2171}; 2177};
2172 2178
2173const int nb_settings = sizeof(settings)/sizeof(*settings); 2179const 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 @@
374 sync RDS time 374 sync RDS time
375 & off, on & N/A\\ 375 & off, on & N/A\\
376 }% 376 }%
377 377 \opt{clear_settings_on_hold}{
378 clear settings on hold
379 & off, on & N/A\\
380 }%
378 \bottomrule 381 \bottomrule
379 \end{longtable} 382 \end{longtable}
380\end{center} 383\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.
36 to be enabled. 36 to be enabled.
37 \end{description} 37 \end{description}
38 38
39\opt{clear_settings_on_hold}{
40\subsection{\label{ref:ClearOnHold}Hold switch clears settings on startup }
41 This option controls whether Rockbox clears its configuration if the hold
42 switch is enabled during startup.
43
44 \begin{description}
45 \item[Yes.]
46 Clear the settings if the hold switch is enabled during startup.
47 \item[No.]
48 Do not clear the settings, regardless of the hold switch's position.
49 \end{description}
50}
51
39\subsection{\label{ref:IdlePoweroffSetting}Idle Poweroff} 52\subsection{\label{ref:IdlePoweroffSetting}Idle Poweroff}
40 Rockbox can be configured to turn off power after the unit has been idle for 53 Rockbox can be configured to turn off power after the unit has been idle for
41 a defined number of minutes. The \dap{} is idle when playback is stopped or 54 a defined number of minutes. The \dap{} is idle when playback is stopped or