-
Notifications
You must be signed in to change notification settings - Fork 1.3k
rotaryio: Add the ability to set the divisor #5468
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
Conversation
b4b4fa6
to
bc714d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy-editing, and perhaps you don't need to shrink those two builds.
Thanks for simplifying the BAD
transitions. I derived that table from first principles, before I actually coded the rest.
All we do on a BAD state transition is avoid counting up or down, but the same is accomplished by using the "0" table value instead.
At present, Adafruit's rotary encoders all move 1 quadrature cycle per detent, so we originally hard-coded division-by-4. However, other encoders exist, including ones without detents, ones with 2 detents per cycle, and others with 4 detents per cycle. The new `divisor` property and constructor argument allows selecting a divisor of 1, 2, or 4; with the default of 4 giving backward compatibility. The property is not supported (yet?) on espressif MCUs; it throws an error if a value other than 4 is set.
1009c98
to
9eebb3d
Compare
Thanks, rebased & re-enabled on those two boards. They're still within 100 bytes of full in the de_DE translation.. |
I can confirm that 9eebb3d allows my half-cycle encoder to work properly, one increment per click, with divisor=2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@evildave666 Thank you for testing! @jepler thank you for solving this!
What was the reason for the lack of support for espressif boards? |
At present, Adafruit's rotary encoders all move 1 quadrature cycle per detent, so we originally hard-coded division-by-4. However, other encoders exist, including ones without detents, ones with 2 detents per cycle, and others with 4 detents per cycle.
The new
divisor
property and constructor argument allows selecting a divisor of 1, 2, or 4; with the default of 4 giving backward compatibility.The property is not supported (yet?) on espressif MCUs; it throws an error if a value other than 4 is set.
It doesn't quite fit but it may after #5466 goes in. Or we could turn off rotaryio in a few more places, like adalogger_m0.
Closes: #5431