refactor(settings): Add Kconfig option for settings debounce
This commit is contained in:
parent
8b91918352
commit
177b28f01d
3 changed files with 11 additions and 2 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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…
Reference in a new issue