forked from kofal.net/zmk
Added a new CONFIG_ZMK_SETTINGS_RESET_ON_START option which enables init code to call zmk_settings_erase(), and changed the settings_reset shield to use it instead of CONFIG_ZMK_BLE_CLEAR_BONDS_ON_START, so it now resets all settings instead of just clearing BLE bonds. CONFIG_ZMK_BLE_CLEAR_BONDS_ON_START is left in place for now in case someone still needs it. It may be replaced in the future once we find a better way to repair a broken split connection.
20 lines
502 B
C
20 lines
502 B
C
/*
|
|
* Copyright (c) 2023 The ZMK Contributors
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#include <zephyr/device.h>
|
|
#include <zephyr/init.h>
|
|
|
|
#include <zmk/settings.h>
|
|
|
|
static int reset_settings_init(const struct device *dev) {
|
|
ARG_UNUSED(dev);
|
|
return zmk_settings_erase();
|
|
}
|
|
|
|
// Reset after the kernel is initialized but before any application code to
|
|
// ensure settings are cleared before anything tries to use them.
|
|
SYS_INIT(reset_settings_init, POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY);
|