mathertel / RotaryEncoder

RotaryEncoder Arduino Library
Other
328 stars 107 forks source link

Skips a step on direction change #19

Closed ilium007 closed 3 years ago

ilium007 commented 4 years ago

The library works fine in either direction with a Bourns PEC-12R rotary encoder except when changing direction. When changing direction it takes another click on the encoder to register an increase or decrease.

ilium007 commented 4 years ago

Just worked out, it only does it when signals are running via the R/C circuit and then inverting Schmitt-trigger that I use in my designs - 74HC14N. Works fine when the 74HC14N is removed from circuit.

rkonklex commented 4 years ago

Interesting! I also had the library skip steps when changing direction. I'm using it with a 100PPR manual pulse generator. It has 6 terminals including both positive and inverted A & B outputs. The library skipped a step when connected to positive A & B outputs, but the problem disappeared when inverted outputs were used. Still, IMO it's a bug, the library should handle both cases equally.

mathertel commented 3 years ago

This may be caused by the fact that the version < 1.5.0 only reported a new value on state 3 (not on state 0) What is the state value, when the encoder is in a latch position ?

Please check with the new parameter on initialization.

ilium007 commented 3 years ago

Sorry, why was the issue closed? Had it been fixed?

mathertel commented 3 years ago

I did a lot of testing during implementing the new version and never saw this behavior. Please re-test with new version and maybe you can add more information for the root cause. Feel free to send me a pull request.

ilium007 commented 3 years ago

New version works perfectly for me now. Thanks!

ilium007 commented 3 years ago

This may be caused by the fact that the version < 1.5.0 only reported a new value on state 3 (not on state 0) What is the state value, when the encoder is in a latch position ?

Please check with the new parameter on initialization.

This was the reason it failed for me.