To unsubscribe from this group and stop receiving emails from it, send an email to pidp-11+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pidp-11/fde91d74-3561-4f26-ad46-2f2e01c3574f%40softjar.se.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-11+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pidp-11/21326c04-bba5-412c-ba67-262eabd3ebd9%40softjar.se.
The sequence of bits for each rotary encoder is:
0b11 0b01 0b00 0b10 0b11 in the CW direction or 0b11 0b10 0b00 0b01 0b11 in the CCW direction.
The rotary switches, when partially actuated (but not so
far as to move to the next detent) will produce an invalid sequence that
was, nevertheless, acted upon by the original code, giving a false
count.
e.g. 11 01 01 11 would give a false CCW count even though the switch returned to its original position after a partial turn.
I modified the code to look only for the corresponding start and end sequences so that only valid sequences are accepted.
This, for me, produces a consistent and repeatable action. When I return the switch to its original position, the corresponding indicator shows.
The changed file is here ...I sent this to Michael, but I might as well send it here too.
The current knob decoding is pretty ugly, and is really abusing/missing
the point of gray encoding.
I rewrote that whole function (check_rotary_encoders()) to make it
behave much more properly. I haven't had a chance to test this yet, but
maybe someone else can?
The function is now a lot shorter, and easier to understand. In
addition, it's now also easy if you'd want to have some other "speed" on
the rotary knobs. Heck, you could even make that into another
environment variable, if you wanted it to be more flexible.
I haven't touched any other part of that file, so the rest is still in
whatever shape it was before. Even the code I changed isn't fully in a
style I'd really write in, but I tried to stay somewhat in form of the
rest of the code in there.
If someone tests this, let me know.
Johnny
On 5/21/26 09:54, Johnny Billquist wrote:
> Argh. You're right. The code is weird. Ok, I'll check what you've done
> tonight. :-)
>
> Johnny
>