Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve debounce handling #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

utopiafallen
Copy link

KeyStateCoolDown is reset on every key down event instead of only when a key press event would trigger. This fixes my key chatter issue where I think my keys were oscillating rapidly between up/down states over a period of time that could overlap with the cooldown mechanism in such a way as to trigger multiple key presses in a short period of time.

By resetting the cooldown on every key down state, oscillations are suppressed because the key up and refresh delays to only start elapsing once the key has stabilized in the up state.

KeyStateCoolDown is reset on every key down event instead of only when a key press event would trigger. This fixes my key chatter issue where I think my keys were oscillating rapidly between up/down states over a period of time that could overlap with the cooldown mechanism in such a way as to trigger multiple key presses in a short period of time.

By resetting the cooldown on every key down state, oscillations are suppressed because the key up and refresh delays to only start elapsing once the key has stabilized in the up state.
@nitsujri
Copy link

I'm facing the same problem even with v2.8 flashed in.

How did this compare to just increasing KeyUpDelay / builder_keyup_delay? It seems like that's the original mechanism designed to ignore oscillations on the contacts.

@utopiafallen
Copy link
Author

Fiddling with the KeyUpDelay was kind of like playing whack-a-mole for me where I was trying to find a value that retained responsive key-presses while suppressing chatter on problematic keys. That got tedious pretty quickly and would need periodic adjustments as new keys started chattering or old keys got worse.

This patch lets you keep a short KeyUpDelay while effectively letting problematic keys auto-scale its KeyUpDelay based on how "chatty" it is. Basically, the new debounce algorithm in 2.8 was very close to being right and this was the missing change for me. I have had no issues with key chatter since I made the change. You can tell from the diff that the change is pretty trivial to just make yourself and try it out locally.

@nitsujri
Copy link

Great, I'll give it a go first instead of trying the KeyUpDelay wack-a-mole.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants