mirror of https://github.com/zmkfirmware/zmk.git
fix(behaviors): Correct macro release state for parametrized macros (#2942)
test(behaviors): Add parametrized macro test that fails fix(behaviors): Correct macro release state for parametrized
This commit is contained in:
parent
d09087f4dc
commit
1bac680c4f
|
|
@ -129,7 +129,9 @@ static int behavior_macro_init(const struct device *dev) {
|
||||||
LOG_DBG("Release will resume at %d", state->release_state.start_index);
|
LOG_DBG("Release will resume at %d", state->release_state.start_index);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// Ignore regular invokable bindings
|
// Mostly ignore regular invokable bindings, except they will consume macro parameters
|
||||||
|
state->release_state.param1_source = PARAM_SOURCE_BINDING;
|
||||||
|
state->release_state.param2_source = PARAM_SOURCE_BINDING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
s/.*hid_listener_keycode/kp/p
|
||||||
|
s/.*mo_keymap_binding/mo/p
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
kp_pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
kp_released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
mo_pressed: position 0 layer 1
|
||||||
|
kp_pressed: usage_page 0x07 keycode 0x1C implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
kp_released: usage_page 0x07 keycode 0x1C implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
mo_released: position 0 layer 1
|
||||||
|
kp_pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
kp_released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
#include <dt-bindings/zmk/keys.h>
|
||||||
|
#include <behaviors.dtsi>
|
||||||
|
#include <dt-bindings/zmk/kscan_mock.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
macros {
|
||||||
|
kp_l1: kp_l1 {
|
||||||
|
compatible = "zmk,behavior-macro-one-param";
|
||||||
|
#binding-cells = <1>;
|
||||||
|
wait-ms = <5>;
|
||||||
|
tap-ms = <5>;
|
||||||
|
bindings
|
||||||
|
= <¯o_param_1to1>
|
||||||
|
, <¯o_tap &kp MACRO_PLACEHOLDER>
|
||||||
|
, <¯o_press &mo 1>
|
||||||
|
, <¯o_pause_for_release>
|
||||||
|
, <¯o_release &mo 1>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
keymap {
|
||||||
|
compatible = "zmk,keymap";
|
||||||
|
|
||||||
|
default_layer {
|
||||||
|
bindings = <
|
||||||
|
&kp_l1 A &kp B
|
||||||
|
&kp C &none>;
|
||||||
|
};
|
||||||
|
|
||||||
|
other_layer {
|
||||||
|
bindings = <
|
||||||
|
&kp X &kp Y
|
||||||
|
&kp Z &none>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&kscan {
|
||||||
|
events = <
|
||||||
|
ZMK_MOCK_PRESS(0,0,20) // press macro (taps A)
|
||||||
|
ZMK_MOCK_PRESS(0,1,20) // press Y
|
||||||
|
ZMK_MOCK_RELEASE(0,1,20) // release Y
|
||||||
|
ZMK_MOCK_RELEASE(0,0,20) // release macro
|
||||||
|
ZMK_MOCK_PRESS(1,0,10) // press C
|
||||||
|
ZMK_MOCK_RELEASE(1,0,10) // release C
|
||||||
|
>;
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue