-
-
Notifications
You must be signed in to change notification settings - Fork 39.9k
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 ENCODER_DEFAULT_POS to recognize lost ticks #16932
Conversation
When resetting the pulses due to reaching the ENCODER_DEFAULT_POS no events were emitted, when Modified encoder_update to be more permissive about lost pulses when returning to the ENCODER_DEFAULT_POS 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 ENCODER_DEFAULT_POS and pulses are present, we can be sure, that a tick has happened. This modification catches all these lost ticks with only 1,2 or 3 pulses, which results in a more reliable performance of the rotary encoder.
I tested it on my Keychron q2 and it makes the rotary encoder perform noticeable better. This enhances the existing ENCODER_DEFAULT_POS feature and i think it is not necessary to change the documentation. |
corrected formatting
This is one potential solution to #16927. |
Tested on Keychron Q3 👍 seems to work fine! |
For me, this causes the rotary knob on the Keychron Q3 to become too sensitive; every "click" of the knob will result in multiple triggers of the associated key (in my case, volume up). |
@FWest98 there is only a click when returning to the default position. So it is impossible to receive multiple triggers with one tick. Until you are not using the encoder really quick, there won’t be a difference to standard behaviour. It is about speed not sensitivity. |
I think the issue is that I didn't set the default position, but if that would cause the encoder to be much more sensitive, I think this PR changes default behaviour in a way I am not sure is desirable... 🤔 |
@FWest98 as you talk about the keychron q3 i think the rotary encoder is exactly the same like on the Q2. I think you see both solutions in competetion when they are clearly not. The solution #16954 just changes the way how the pulses are detected to allow for insertion in case of interrupts. But during interrupt handling further state changes will still be lost. So the best solution is to use both at the same time. I have it running this way, since i made the Pull Request and it works definetly and testable better. How did i verify:
What bothers me, is that you say this patch would introduce ghosting, when it doesn't and just state this on your feeling. Please elaborate why do you think, that this patch would affect the keychron fix in any way negatively? |
I don't mean to say it introduces ghosting, but without setting As for the difference between the Keychron PR and this one, my observation is based on debug-logging the observed state-values in the When I find some time, I will try to reproduce this test, to make sure it was not a fluke or anything. |
@FWest98 There are no changes outside of ENCODER_DEFAULT_POS introduced by this patch. |
@FWest98 please double-check that you have |
Modified encoder_update to be more permissive about lost pulses when returning to the ENCODER_DEFAULT_POS 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 ENCODER_DEFAULT_POS and pulses are present, we can be sure, that a tick has happened. This modification catches all these lost ticks with only 1,2 or 3 pulses, which results in a more reliable performance of the rotary encoder.
Description
Modified the encoder_update method to emit ticks even when not all pulses have been detected but direction is clear and the rotary encoder returned to its ENCODER_DEFAULT_POS.
Types of Changes
Issues Fixed or Closed by This PR
Checklist