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

Optimize keyscanner for 'avr' native keyboards #473

Merged
merged 11 commits into from Nov 21, 2018

Conversation

obra
Copy link
Member

@obra obra commented Nov 21, 2018

@algernon - Please have a look at this branch. I believe it's significantly faster than your handrolled atreus keyscanner. (And fixes a serious bug that was masked by having a really slow scanner ;)

Signed-off-by: Jesse Vincent <jesse@keyboard.io>
Signed-off-by: Jesse Vincent <jesse@keyboard.io>
This reverts commit 91b7c0c.

Signed-off-by: Jesse Vincent <jesse@keyboard.io>
what we 'really' want per switch manufacturers

Signed-off-by: Jesse Vincent <jesse@keyboard.io>
not just when the timer triggers

Signed-off-by: Jesse Vincent <jesse@keyboard.io>
reading.

(This eliminates a "chatter" causing bug

Signed-off-by: Jesse Vincent <jesse@keyboard.io>
obra and others added 5 commits November 20, 2018 19:59
Otherwise, for example, Pin F0 may not be read on the Planck
Signed-off-by: Jesse Vincent <jesse@keyboard.io>
Based on the change made to `ATMegaKeyboard`, apply the same treatment to the
`ErgoDoxScanner` too, and run debouncing only 3 times per 5ms, which is closer
to what switch manufacturers recommend.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Set the previous key state when reporting the state to Kaleidoscope, instead of
on every read. This eliminates a possible chatter bug. Idea taken from a similar
change made to `ATMegaKeyboard`.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Instead of only reporting the state when the timer triggers, report it every
loop, even if it is unchanged.

This is based on a similar change to `ATMegaKeyboard`.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Based on a similar change to `ATMegaKeyboard`.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
@algernon
Copy link
Contributor

Loving it. Code size is bigger (by about 800 bytes), but cycle times went from 0.64ms to 0.16ms. That alone is worth the extra size in my book, especially when paired with a serious bug fixed.

I pushed a few ErgoDox changes that apply similar fixes & optimizations there. The speedup in that case isn't that big (yet): from 2.2ms to 1.6ms using my own sketch, at the cost of ~800 bytes of PROGMEM. There's room to improve in the ErgoDox case, I think, but this is already nice enough.

@algernon algernon merged commit 8739684 into master Nov 21, 2018
@algernon algernon deleted the f/optimize-avr-keyboards branch November 21, 2018 06:43
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.

None yet

2 participants