feat: Add global macro timing configs

Added ZMK_MACRO_DEFAULT_WAIT_MS and ZMK_MACRO_DEFAULT_TAP_MS to set
global defaults for the wait-ms and tap-ms properties of macros.

Also reduced the default timings for macros, since it's been reported
many times that 100 ms is too slow.
This commit is contained in:
Joel Spadin
2022-12-11 12:20:56 -06:00
committed by Pete Johanson
parent 11ca0098a5
commit 3eb06f137b
5 changed files with 25 additions and 12 deletions

View File

@@ -355,6 +355,14 @@ config ZMK_BEHAVIOR_KEY_TOGGLE
bool
default $(dt_compat_enabled,$(DT_COMPAT_ZMK_BEHAVIOR_KEY_TOGGLE))
config ZMK_MACRO_DEFAULT_WAIT_MS
int "Default time to wait (in milliseconds) before triggering the next behavior in macros"
default 15
config ZMK_MACRO_DEFAULT_TAP_MS
int "Default time to wait (in milliseconds) between the press and release events of a tapped behavior in macros"
default 30
endmenu
menu "Advanced"

View File

@@ -13,9 +13,7 @@ properties:
required: true
wait-ms:
type: int
default: 100
description: The default time to wait (in milliseconds) before triggering the next behavior in the macro bindings list.
tap-ms:
type: int
default: 100
description: The default time to wait (in milliseconds) between the press and release events on a tapped macro behavior binding

View File

@@ -174,8 +174,8 @@ static const struct behavior_driver_api behavior_macro_driver_api = {
#define MACRO_INST(n) \
static struct behavior_macro_state behavior_macro_state_##n = {}; \
static struct behavior_macro_config behavior_macro_config_##n = { \
.default_wait_ms = DT_INST_PROP_OR(n, wait_ms, 100), \
.default_tap_ms = DT_INST_PROP_OR(n, tap_ms, 100), \
.default_wait_ms = DT_INST_PROP_OR(n, wait_ms, CONFIG_ZMK_MACRO_DEFAULT_WAIT_MS), \
.default_tap_ms = DT_INST_PROP_OR(n, tap_ms, CONFIG_ZMK_MACRO_DEFAULT_TAP_MS), \
.count = DT_INST_PROP_LEN(n, bindings), \
.bindings = TRANSFORMED_BEHAVIORS(n)}; \
DEVICE_DT_INST_DEFINE(n, behavior_macro_init, NULL, &behavior_macro_state_##n, \

View File

@@ -1,6 +1,6 @@
queue_process_next: Invoking KEY_PRESS: 0x70004 0x00
kp_pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
queue_process_next: Processing next queued behavior in 100ms
queue_process_next: Processing next queued behavior in 30ms
queue_process_next: Invoking KEY_PRESS: 0x70004 0x00
kp_released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
queue_process_next: Processing next queued behavior in 50ms