summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorNick Winans <nick@winans.codes>2020-12-08 22:15:59 -0600
committerPete Johanson <peter@peterjohanson.com>2020-12-14 22:46:49 -0500
commit69d48c5715885facee84259bfff3e277fa56bc2c (patch)
tree4068501f258fb6c43784cd9136562b256b9cbb58 /app
parentb5e17e3b0f527bea95d27db1b27d5a4be3fed4a1 (diff)
refactor(settings): Only load used subtrees
Diffstat (limited to 'app')
-rw-r--r--app/CMakeLists.txt1
-rw-r--r--app/src/ble.c3
-rw-r--r--app/src/endpoints.c2
-rw-r--r--app/src/ext_power_generic.c2
-rw-r--r--app/src/rgb_underglow.c2
-rw-r--r--app/src/settings.c8
6 files changed, 7 insertions, 11 deletions
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index e6887dd..5174576 100644
--- a/app/CMakeLists.txt
+++ b/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(app PRIVATE src/endpoints.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)
add_subdirectory(src/display/)
diff --git a/app/src/ble.c b/app/src/ble.c
index d335f94..1f311a0 100644
--- a/app/src/ble.c
+++ b/app/src/ble.c
@@ -526,7 +526,8 @@ static int zmk_ble_init(const struct device *_arg) {
return err;
}
- settings_load();
+ settings_load_subtree("ble");
+ settings_load_subtree("bt");
#endif
diff --git a/app/src/endpoints.c b/app/src/endpoints.c
index f432ac2..ad44822 100644
--- a/app/src/endpoints.c
+++ b/app/src/endpoints.c
@@ -166,7 +166,7 @@ static int zmk_endpoints_init(const struct device *_arg) {
return err;
}
- settings_load();
+ settings_load_subtree("endpoints");
#endif
return 0;
diff --git a/app/src/ext_power_generic.c b/app/src/ext_power_generic.c
index 71d1209..9ab18c4 100644
--- a/app/src/ext_power_generic.c
+++ b/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)
+ settings_subsys_init();
+
settings_register(&ext_power_conf);
k_delayed_work_init(&ext_power_save_work, ext_power_save_state_work);
diff --git a/app/src/rgb_underglow.c b/app/src/rgb_underglow.c
index f5ed9ce..1603e34 100644
--- a/app/src/rgb_underglow.c
+++ b/app/src/rgb_underglow.c
@@ -265,6 +265,8 @@ static int zmk_rgb_underglow_init(const struct device *_arg) {
};
#if IS_ENABLED(CONFIG_SETTINGS)
+ settings_subsys_init();
+
settings_register(&rgb_conf);
k_delayed_work_init(&underglow_save_work, zmk_rgb_underglow_save_state_work);
diff --git a/app/src/settings.c b/app/src/settings.c
deleted file mode 100644
index 9366dd2..0000000
--- a/app/src/settings.c
+++ /dev/null
@@ -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);