Browse Source

refactor(settings): Add Kconfig option for settings debounce

xmkb
Nick 4 years ago committed by Pete Johanson
parent
commit
177b28f01d
  1. 9
      app/Kconfig
  2. 2
      app/src/ext_power_generic.c
  3. 2
      app/src/rgb_underglow.c

9
app/Kconfig

@ -297,6 +297,15 @@ config ZMK_KSCAN_COMPOSITE_DRIVER
#KSCAN Settings #KSCAN Settings
endmenu endmenu
if SETTINGS
config ZMK_SETTINGS_SAVE_DEBOUNCE
int "Milliseconds to debounce settings saves"
default 60000
#SETTINGS
endif
#Advanced #Advanced
endmenu endmenu

2
app/src/ext_power_generic.c

@ -49,7 +49,7 @@ static struct k_delayed_work ext_power_save_work;
int ext_power_save_state() { int ext_power_save_state() {
#if IS_ENABLED(CONFIG_SETTINGS) #if IS_ENABLED(CONFIG_SETTINGS)
k_delayed_work_cancel(&ext_power_save_work); k_delayed_work_cancel(&ext_power_save_work);
return k_delayed_work_submit(&ext_power_save_work, K_MINUTES(1)); return k_delayed_work_submit(&ext_power_save_work, K_MSEC(CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE));
#else #else
return 0; return 0;
#endif #endif

2
app/src/rgb_underglow.c

@ -279,7 +279,7 @@ static int zmk_rgb_underglow_init(struct device *_arg) {
int zmk_rgb_underglow_save_state() { int zmk_rgb_underglow_save_state() {
#if IS_ENABLED(CONFIG_SETTINGS) #if IS_ENABLED(CONFIG_SETTINGS)
k_delayed_work_cancel(&underglow_save_work); k_delayed_work_cancel(&underglow_save_work);
return k_delayed_work_submit(&underglow_save_work, K_MINUTES(1)); return k_delayed_work_submit(&underglow_save_work, K_MSEC(CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE));
#else #else
return 0; return 0;
#endif #endif

Loading…
Cancel
Save