You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a problem getting three different encoders working with your library. It's the kind of encoder, which contains pullups and capacitors for immediate use. Checked the encoder with oscilloscope, all three are working fine, without any chatter/bouncing, perfect squares. I tested them with an esp8266, a bluepill and a nano, but no success.
Then I dived into your source, and found out, that all this encoders are not compatible with the current encoder logic.
The encoders keep in idle state both pins high, and produce the following states, when turning one step clockwise:
11
10
00 <- this change triggers interrupt
01
11 <- this change triggers interrupt
and when turning counterclockwise, it will look like this:
11
01 <- this change triggers interrupt
00
10 <- this change triggers interrupt
11
this leads to the consequence, that the current switch-statements in the readAB() method do not trigger.
When I changed it to:
case 0b1100: // case 0b0011:
_counter++;
break;
case 0110: // case 0b1101:
_counter--;
break;
it triggers.
Currently I struggle however with the two respective four cases statements in your code, as for me one statement is enough, to get 1 count per step/click. With two statements i receive two counts on all tested platforms.
From the core logic four statements make no sense at all, as the irq-handler is tied to pin A, so there are not more than two possibilities, as changes on pinB are meaningless.
I would like to create an pull-request for a more general solution, but I would like to understand before, if I am on the right way, or if I miss some aspects of other hardware.
The text was updated successfully, but these errors were encountered:
Hello,
I had a problem getting three different encoders working with your library. It's the kind of encoder, which contains pullups and capacitors for immediate use. Checked the encoder with oscilloscope, all three are working fine, without any chatter/bouncing, perfect squares. I tested them with an esp8266, a bluepill and a nano, but no success.
Then I dived into your source, and found out, that all this encoders are not compatible with the current encoder logic.
The encoders keep in idle state both pins high, and produce the following states, when turning one step clockwise:
and when turning counterclockwise, it will look like this:
this leads to the consequence, that the current switch-statements in the readAB() method do not trigger.
When I changed it to:
it triggers.
Currently I struggle however with the two respective four cases statements in your code, as for me one statement is enough, to get 1 count per step/click. With two statements i receive two counts on all tested platforms.
From the core logic four statements make no sense at all, as the irq-handler is tied to pin A, so there are not more than two possibilities, as changes on pinB are meaningless.
I would like to create an pull-request for a more general solution, but I would like to understand before, if I am on the right way, or if I miss some aspects of other hardware.
The text was updated successfully, but these errors were encountered: