diff --git a/app/src/endpoints.c b/app/src/endpoints.c index 7aabc5d4..0728fff3 100644 --- a/app/src/endpoints.c +++ b/app/src/endpoints.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -35,13 +35,12 @@ static void endpoints_save_preferred_work(struct k_work *work) { settings_save_one("endpoints/preferred", &preferred_endpoint, sizeof(preferred_endpoint)); } -static struct k_delayed_work endpoints_save_work; +static struct k_work_delayable endpoints_save_work; #endif static int endpoints_save_preferred() { #if IS_ENABLED(CONFIG_SETTINGS) - k_delayed_work_cancel(&endpoints_save_work); - return k_delayed_work_submit(&endpoints_save_work, K_MSEC(CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE)); + return k_work_reschedule(&endpoints_save_work, K_MSEC(CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE)); #else return 0; #endif @@ -216,7 +215,7 @@ static int zmk_endpoints_init(const struct device *_arg) { return err; } - k_delayed_work_init(&endpoints_save_work, endpoints_save_preferred_work); + k_work_init_delayable(&endpoints_save_work, endpoints_save_preferred_work); settings_load_subtree("endpoints"); #endif