Browse Source

refactor(settings): Only load used subtrees

xmkb
Nick Winans 4 years ago committed by Pete Johanson
parent
commit
69d48c5715
  1. 1
      app/CMakeLists.txt
  2. 3
      app/src/ble.c
  3. 2
      app/src/endpoints.c
  4. 2
      app/src/ext_power_generic.c
  5. 2
      app/src/rgb_underglow.c
  6. 8
      app/src/settings.c

1
app/CMakeLists.txt

@ -65,7 +65,6 @@ target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/hog.c)
target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/rgb_underglow.c) target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/rgb_underglow.c)
target_sources(app PRIVATE src/endpoints.c) target_sources(app PRIVATE src/endpoints.c)
target_sources(app PRIVATE src/hid_listener.c) target_sources(app PRIVATE src/hid_listener.c)
target_sources_ifdef(CONFIG_SETTINGS app PRIVATE src/settings.c)
target_sources(app PRIVATE src/main.c) target_sources(app PRIVATE src/main.c)
add_subdirectory(src/display/) add_subdirectory(src/display/)

3
app/src/ble.c

@ -526,7 +526,8 @@ static int zmk_ble_init(const struct device *_arg) {
return err; return err;
} }
settings_load(); settings_load_subtree("ble");
settings_load_subtree("bt");
#endif #endif

2
app/src/endpoints.c

@ -166,7 +166,7 @@ static int zmk_endpoints_init(const struct device *_arg) {
return err; return err;
} }
settings_load(); settings_load_subtree("endpoints");
#endif #endif
return 0; return 0;

2
app/src/ext_power_generic.c

@ -140,6 +140,8 @@ static int ext_power_generic_init(const struct device *dev) {
} }
#if IS_ENABLED(CONFIG_SETTINGS) #if IS_ENABLED(CONFIG_SETTINGS)
settings_subsys_init();
settings_register(&ext_power_conf); settings_register(&ext_power_conf);
k_delayed_work_init(&ext_power_save_work, ext_power_save_state_work); k_delayed_work_init(&ext_power_save_work, ext_power_save_state_work);

2
app/src/rgb_underglow.c

@ -265,6 +265,8 @@ static int zmk_rgb_underglow_init(const struct device *_arg) {
}; };
#if IS_ENABLED(CONFIG_SETTINGS) #if IS_ENABLED(CONFIG_SETTINGS)
settings_subsys_init();
settings_register(&rgb_conf); settings_register(&rgb_conf);
k_delayed_work_init(&underglow_save_work, zmk_rgb_underglow_save_state_work); k_delayed_work_init(&underglow_save_work, zmk_rgb_underglow_save_state_work);

8
app/src/settings.c

@ -1,8 +0,0 @@
#include <device.h>
#include <init.h>
#include <kernel.h>
#include <settings/settings.h>
static int zmk_settings_init(const struct device *_arg) { return settings_load(); }
SYS_INIT(zmk_settings_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
Loading…
Cancel
Save