From 8cb7061f9c059f650a2672b08cf794e74d078786 Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Tue, 19 Mar 2024 10:50:04 -0700 Subject: [PATCH] fix: Add settings reset on start init priority. * Add a dedicated settings reset on start init priority and default it to lower priority (high number) than default FLASH_INIT_PRIORITY to be sure flash is initialized before we open the area. --- app/Kconfig | 9 +++++++++ app/src/settings/reset_settings_on_start.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Kconfig b/app/Kconfig index 3f797abd41d7..09b64f29a59b 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -568,6 +568,15 @@ if SETTINGS config ZMK_SETTINGS_RESET_ON_START bool "Delete all persistent settings when the keyboard boots" +if ZMK_SETTINGS_RESET_ON_START + +config ZMK_SETTINGS_RESET_ON_START_INIT_PRIORITY + int "Settings Reset ON Start Initialization Priority" + default 60 + +endif + + config ZMK_SETTINGS_SAVE_DEBOUNCE int "Milliseconds to debounce settings saves" default 60000 diff --git a/app/src/settings/reset_settings_on_start.c b/app/src/settings/reset_settings_on_start.c index 47f5e8f22591..0f6d4fae9fb9 100644 --- a/app/src/settings/reset_settings_on_start.c +++ b/app/src/settings/reset_settings_on_start.c @@ -10,4 +10,4 @@ // Reset after the kernel is initialized but before any application code to // ensure settings are cleared before anything tries to use them. -SYS_INIT(zmk_settings_erase, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(zmk_settings_erase, POST_KERNEL, CONFIG_ZMK_SETTINGS_RESET_ON_START_INIT_PRIORITY);