KMKfw / kmk_firmware

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

[BUG] Keyboard freezes when pressing keys, sometimes unfreezes #992

Closed anventia closed 1 week ago

anventia commented 1 week ago

Describe the bug When I start typing, especially when I type faster, my keyboard would lag, with the keys taking a delay between keypress and key registered by my PC. When I stop typing, it continues sending the backlog of keycodes.

Sometimes, it freezes completely. If it happens when a key is pressed, it never registers the key being released and it acts as the key is held down. If it freezes between keypresses and no key is held down, it can't register any more keypresses.

Most of the time, I have to hit the reset button to get out of the freeze, but sometimes it will come back and keep pressing the backlog of keys RAPIDLY if I pressed any right after the freeze.

I have RGB backlighting, and the animation will freeze and resume with the keystrokes.

To Reproduce Steps to reproduce the behavior: I don't know the exact way to reproduce this, but I just set up the firmware as normal, following the guide. Aside from the essentials, I have imported RGB, AnimationModes, EncoderHandler, MediaKeys, LED. I tried disabling all of this, but it made no difference.

Expected behavior I expect the keys to be sent as they are pressed, and not lag behind or crash.

Debug output The serial console messages saying key down and key up line up with my observations, ex. when it freezes holding down a key, the last message in the console is a key being pressed down, with no key release message following it.

Additional context My board is a WeAct RP2040 Pico, and I'm running CircuitPython 9.0.5 and the latest version of KMK as of 2024/06/19.

anventia commented 1 week ago

Update: It seems to be caused by the debug console, disabling it fixes the issue. Maybe it uses up too much CPU printing the lines after each keypress? Not sure if this is fixable then.