diff --git a/app/Kconfig b/app/Kconfig index 3502c6527576..936343e20992 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -245,6 +245,18 @@ endmenu #Basic Keyboard Setup endmenu +menu "Encoders" + +config ZMK_ENCODERS_DEFAULT_TRIGGERS_PER_ROTATION + int "Default behavior triggers per rotation" + help + Unless overridden for a specific behavior in the keymap/devicetree, this value + determines how many times to trigger the bound behavior per full rotation. + For tactile encoders with detents, this usually should match the number of + detents per rotation of the encoder. + default 30 + +endmenu menu "Display/LED Options" rsource "src/display/Kconfig" diff --git a/app/dts/bindings/behaviors/zmk,behavior-sensor-rotate-key-press.yaml b/app/dts/bindings/behaviors/zmk,behavior-sensor-rotate-key-press.yaml index 32cd07d88eb8..ec2a9a3411c0 100644 --- a/app/dts/bindings/behaviors/zmk,behavior-sensor-rotate-key-press.yaml +++ b/app/dts/bindings/behaviors/zmk,behavior-sensor-rotate-key-press.yaml @@ -9,7 +9,7 @@ properties: label: type: string required: true - activation-resolution: + triggers-per-rotation: type: int required: false "#sensor-binding-cells": diff --git a/app/src/behaviors/behavior_sensor_rotate_key_press.c b/app/src/behaviors/behavior_sensor_rotate_key_press.c index 26c2dbe6737f..1a5666bc8f81 100644 --- a/app/src/behaviors/behavior_sensor_rotate_key_press.c +++ b/app/src/behaviors/behavior_sensor_rotate_key_press.c @@ -78,7 +78,7 @@ static const struct behavior_driver_api behavior_sensor_rotate_key_press_driver_ #define KP_INST(n) \ static const struct behavior_sensor_rotate_key_press_cfg \ behavior_sensor_rotate_key_press_cfg_##n = { \ - .activation_resolution = DT_INST_PROP_OR(n, activation_resolution, 1)}; \ + .activation_resolution = (360 / DT_INST_PROP_OR(n, triggers_per_rotation, CONFIG_ZMK_ENCODERS_DEFAULT_TRIGGERS_PER_ROTATION))}; \ static struct behavior_sensor_rotate_key_press_sensor_data \ behavior_sensor_rotate_key_press_sensor_data_##n; \ DEVICE_DT_INST_DEFINE(n, behavior_sensor_rotate_key_press_init, device_pm_control_nop, \