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

Encoder module: Pins will be checks during initialization and module state will be calculated correctly. #187

Merged
merged 1 commit into from Nov 3, 2015

Conversation

luwar
Copy link
Contributor

@luwar luwar commented Nov 2, 2015

The encoder module did not check the states of the two input pins. this.last was set to 0 while PINA and PINB could be 1.
This leads to the strange behavior that the first rotary movement could result in +1/-1 while the following movement will result in +2/-2.

This pull request uses the available onChange() method to initialize the state of the module without changing any other behavior.

@gfwilliams
Copy link
Member

Thanks!

gfwilliams added a commit that referenced this pull request Nov 3, 2015
Encoder module: Pins will be checks during initialization and module state will be calculated correctly.
@gfwilliams gfwilliams merged commit 7a3de2d into espruino:master Nov 3, 2015
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

Successfully merging this pull request may close these issues.

None yet

2 participants