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

Separate scanning and debouncing #3646

Closed
alex-ong opened this issue Aug 14, 2018 · 2 comments
Closed

Separate scanning and debouncing #3646

alex-ong opened this issue Aug 14, 2018 · 2 comments

Comments

@alex-ong
Copy link
Contributor

alex-ong commented Aug 14, 2018

I raised the same thing in TMK, but nothing's really happened since January.

(Issue: tmk/tmk_keyboard#525)

(Pull request: tmk/tmk_keyboard#531)

Reasons for this change:

  1. Debounce algorithms are wrong, and are per keyboard, so that's a lot of wrong keyboards.
    There are two main algorithms (both are wrong)
    a) Global timer, that resets when any key changes. When entire keyboard is stable for 5ms, process keys
    Disadvantage is if i can spam 5 keys with a 4.999ms gap between each one, processing order is not guaranteed to be same as actual pressing order
    b) Poll and wait for x consecutive same inputs for stability. Same problem as above (pressing multiple keys within 5ms of each other), and in addition, x consecutive inputs may or may not be 5ms.
  2. Since debounce is per keyboard, cleaning up the codebase now would be a nightmare
  3. However, if we separate it out now, and make debouncing optional, we can fix future keyboards.

Flow on effects:
Old workflow - scan_matrix() does both scanning and debouncing

New workflow - scan_matrix(), followed by debounce_matrix(). Old keyboards can just have debounce_matrix() as an empty function, still using scan_matrix() to do scanning followed by debouncing. This ensures 100% compatability

Cons: Doing this abstraction requires 1 extra copy of the entire matrix is stored.
Pros: We can have community shared debounce algorithms. Some that have been discussed multiple times are EAGER algorithms, Per-Key algorithms, and a combination of both. We could also still use the current algorithm. Changing algorithms would be a one line code change or #define.

@drashna
Copy link
Member

drashna commented Mar 29, 2019

Well, the PR was merged.

Was this still an issue?

@alex-ong
Copy link
Contributor Author

Nope it's all good close the issue :)

@drashna drashna closed this as completed Mar 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants