Skip to content
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

FSM for rotary encoders does not match the description #6

Open
newbrain opened this issue Sep 26, 2018 · 0 comments
Open

FSM for rotary encoders does not match the description #6

newbrain opened this issue Sep 26, 2018 · 0 comments

Comments

@newbrain
Copy link

The problem described in #3 is actually real, the transition table differs from the documentation.

Why from a state of R_CW_BEGIN, with an input of 0-0 the FSM transition to R_CW_NEXT (third line of the matrix)?
It should of course go back to R_START!

The same problem is there for CCW rotation.

It would seem that the matrix is a mix of the one needed for positive logic (rest state 0-0) and the one for negative logic (1-1).

In addition to the above, though it has probably a very minor effect, the readme.MD in Rotary/ states that:

If an invalid state happens (for example we go from '0-1' straight to '1-0'), the state machine resets to the start until 0-0 and the next valid codes occur.

The implementation will not catch a double invalid transition 0-1 -> 1-0 -> 0-1 as it, in fact, does not wait for the 0-0 state. In this example the final state will be R_CW_BEGIN.

This does not look correct, as also the second transition can be considered faulty.

To make sure that the base state R_START is reached only when the input is 0-0, an eight state is needed (R_FAULT?) that must be entered for all the faulty transitions, and move to R_START when input is 0-0 (with the exception of 1-1 -> 0-0, that can go directly to R_START!)

The cost is very low (4 bytes for the new row in the transition table), and the logic is unchanged.
At 0 code cost, the Readme could be updated instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant