Make the rotary encoder more responsive #16931
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The resolution 4 rotary encoder on my Keychron Q2 is missing a lot of ticks, when not all 4 pulses are detected. By putting a constraint on the default state 0xF of the encoder it is possible to catch a lot of these lost ticks and the performance of the rotary encoder improves noticeable and is reliable.
Description
Modified encoder_update to be more permissive about lost pulses when returning to the default state 0xF (no movement) to detect if a tick has happened. E.g. on resolution 4 rotary encoder all ticks with only 1, 2 or 3 detected pulses have been discarded in the original code, but when the rotary encoder returns to the recognized state of no movement and pulses are present, we can be sure, that a tick has happened. This PR catches all these lost ticks with only 1,2 or 3 pulses, which results in a more reliable performance of the rotary encoder.
Types of Changes
Issues Fixed or Closed by This PR
Rotary encoder losing a lot of ticks, when not all pulses have been recognized.
Checklist