KMKfw / kmk_firmware

Clackety Keyboards Powered by Python
https://kmkfw.zulipchat.com
Other
1.43k stars 481 forks source link

[BUG] OneShot key or StickyKeys doesn't work with LT #1021

Open ikeji opened 2 months ago

ikeji commented 2 months ago

Describe the bug When I type OneShot key then LT key, OneShot key is deactivate before LT key activate.

To Reproduce

Steps to reproduce the behavior:

Expected behavior

Actual behavior

Debug output

Here is an output from kmk firmware. https://gist.github.com/ikeji/c51d65e28ecd7a8451ab10760e00b68d

Additional context

I use RP2040 and CircuitPython 8.2.9. Here is a full source code: https://gist.github.com/ikeji/fb81363d50b842eaa80f5641ec0bba8c

xs5871 commented 2 months ago

The oneshot module is deprecated, please use sticky keys instead.

ikeji commented 2 months ago

Thanks for reply.

The sticky_keys module also have unexpected behavior. And I can't type key inside layer with.

Setup

keyboard.keymap = [
    [ KC.SK(KC.LCTL), KC.LT(1, KC.B), KC.C, ],
    [ KC.D, KC.TRANS, KC.F, ],
]

Input

Expected output

Actual output

Debug output

575407 kmk.keyboard: <Event: key_number 0 pressed>: StickyKey
575409 kmk.keyboard: coordkeys_pressed={0: StickyKey}
575411 kmk.modules.sticky_keys: activate
575414 kmk.keyboard: keys_pressed={ModifierKey(code=1)}
575543 kmk.keyboard: <Event: key_number 0 released>: StickyKey
575546 kmk.keyboard: coordkeys_pressed={}
575816 kmk.keyboard: <Event: key_number 1 pressed>: HoldTapKey
575819 kmk.keyboard: coordkeys_pressed={1: HoldTapKey}
576123 kmk.modules.holdtap: ht_activate_hold
576128 kmk.modules.layers: active_layers=[1, 0]
576168 kmk.keyboard: <Event: key_number 2 pressed>: KeyboardKey(code=14)
576172 kmk.modules.sticky_keys: deactivate
576174 kmk.keyboard: coordkeys_pressed={2: None, 1: HoldTapKey}
576180 kmk.keyboard: coordkeys_pressed={2: KeyboardKey(code=14), 1: HoldTapKey}
576184 kmk.keyboard: keys_pressed={KeyboardKey(code=14)}
576344 kmk.keyboard: <Event: key_number 2 released>: KeyboardKey(code=14)
576349 kmk.keyboard: coordkeys_pressed={1: HoldTapKey}
576500 kmk.keyboard: <Event: key_number 1 released>: HoldTapKey
576503 kmk.keyboard: coordkeys_pressed={}
576504 kmk.modules.holdtap: ht_deactivate_hold
576508 kmk.modules.layers: active_layers=[0]

Here is a full code: https://gist.github.com/ikeji/abf1e2bfe7149309acc3606cc70619a7