Skip to content

Commit

Permalink
fix: Add settings reset on start init priority.
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
petejohanson committed Mar 19, 2024
1 parent 8289431 commit 8cb7061
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/src/settings/reset_settings_on_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit 8cb7061

Please sign in to comment.