refactor(behaviors): Add max-held tap-dance config (#2838)

refactor(behaviors): Add max-held tap-dance config

Add new `CONFIG_ZMK_BEHAVIOR_TAP_DANCE_MAX_HELD` config for reducing RAM
usage on more constrained devices.

refactor(behaviors): Move defaults to Kconfig.defaults
This commit is contained in:
Pete Johanson 2025-02-25 12:12:27 -07:00 committed by GitHub
parent 18d0d2f476
commit 209085da73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 49 additions and 5 deletions

View File

@ -67,7 +67,7 @@ if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_STUDIO_UNLOCK app PRIVATE src/behaviors/behavior_studio_unlock.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_INPUT_TWO_AXIS app PRIVATE src/behaviors/behavior_input_two_axis.c)
target_sources(app PRIVATE src/combo.c)
target_sources(app PRIVATE src/behaviors/behavior_tap_dance.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_TAP_DANCE app PRIVATE src/behaviors/behavior_tap_dance.c)
target_sources(app PRIVATE src/behavior_queue.c)
target_sources(app PRIVATE src/conditional_layer.c)
target_sources(app PRIVATE src/endpoints.c)

View File

@ -51,13 +51,11 @@ if ZMK_BEHAVIOR_HOLD_TAP
config ZMK_BEHAVIOR_HOLD_TAP_MAX_HELD
int "Hold Tap Max Held"
default 10
help
Max number of simultaneously held hold-taps
config ZMK_BEHAVIOR_HOLD_TAP_MAX_CAPTURED_EVENTS
int "Hold Tap Max Captured Events"
default 40
help
Max number of captured system events while waiting to resolve hold taps
@ -82,7 +80,6 @@ if ZMK_BEHAVIOR_STICKY_KEY
config ZMK_BEHAVIOR_STICKY_KEY_MAX_HELD
int "Sticky Key Max Held"
default 10
help
Max number of simultaneously held sticky keys
@ -93,6 +90,21 @@ config ZMK_BEHAVIOR_SOFT_OFF
default y
depends on DT_HAS_ZMK_BEHAVIOR_SOFT_OFF_ENABLED && ZMK_PM_SOFT_OFF
config ZMK_BEHAVIOR_TAP_DANCE
bool
default y
depends on DT_HAS_ZMK_BEHAVIOR_TAP_DANCE_ENABLED
if ZMK_BEHAVIOR_TAP_DANCE
config ZMK_BEHAVIOR_TAP_DANCE_MAX_HELD
int "Tap-Dance Max Held"
help
Max number of simultaneously held taps-dances
endif
config ZMK_BEHAVIOR_INPUT_TWO_AXIS
bool
default y

View File

@ -12,6 +12,32 @@ endif
config ZMK_HID_CONSUMER_REPORT_SIZE
default 6
# Behaviors
if ZMK_BEHAVIOR_HOLD_TAP
config ZMK_BEHAVIOR_HOLD_TAP_MAX_HELD
default 10
config ZMK_BEHAVIOR_HOLD_TAP_MAX_CAPTURED_EVENTS
default 40
endif
if ZMK_BEHAVIOR_STICKY_KEY
config ZMK_BEHAVIOR_STICKY_KEY_MAX_HELD
default 10
endif
if ZMK_BEHAVIOR_TAP_DANCE
config ZMK_BEHAVIOR_TAP_DANCE_MAX_HELD
default 10
endif
# Underglow
if ZMK_RGB_UNDERGLOW

View File

@ -21,7 +21,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
#define ZMK_BHV_TAP_DANCE_MAX_HELD 10
#define ZMK_BHV_TAP_DANCE_MAX_HELD CONFIG_ZMK_BEHAVIOR_TAP_DANCE_MAX_HELD
#define ZMK_BHV_TAP_DANCE_POSITION_FREE UINT32_MAX

View File

@ -325,6 +325,12 @@ Creates a custom behavior that triggers a different behavior corresponding to th
See the [tap dance behavior](../keymaps/behaviors/tap-dance.mdx) documentation for more details and examples.
### Kconfig
| Config | Type | Description | Default |
| ---------------------------------------- | ---- | ---------------------------------------------- | ------- |
| `CONFIG_ZMK_BEHAVIOR_TAP_DANCE_MAX_HELD` | int | Maximum number of simultaneous held tap-dances | 10 |
### Devicetree
Definition file: [zmk/app/dts/bindings/behaviors/zmk,behavior-tap-dance.yaml](https://github.com/zmkfirmware/zmk/blob/main/app/dts/bindings/behaviors/zmk%2Cbehavior-tap-dance.yaml)