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

safer interrupt handling and funciton added for direction detection #7

Merged
merged 1 commit into from Jun 23, 2018

Conversation

sysshad
Copy link
Contributor

@sysshad sysshad commented Jun 22, 2018

All variables changed by an interrupt should have the volatile keyword so the compiler wont think in some optimization mode that these variables never change.
Also added an easy function to only check direction of movement instead that the user must read and check the actual value :)

All variables changed by an interrupt should have the volatile keyword so the compiler wont think in some optimization mode that these variables never change.
Also added an easy function to only check direction of movement instead that the user must read and check the actual value :)
Copy link
Owner

@mathertel mathertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good improvements. Thanks

@mathertel mathertel merged commit 35d0000 into mathertel:master Jun 23, 2018
@sysshad
Copy link
Contributor Author

sysshad commented Jun 23, 2018

Np, thanks for making the library in the first place 👍 Saved me some work hehe.

I made another mod on how to handle the button press, if its down, up, tapped (with debounce check) or held down for x seconds. But its a bigger mod, and i think there are other nicer libraries out there to handle buttons :) mine is quite ugly and relies on using millis() and a polling function in the main loop instead of using interrupt and timer which is is a better way to do it, but is more work :D

Thanks again!

@sysshad
Copy link
Contributor Author

sysshad commented Jun 23, 2018

Oh and btw.. i saw that getDirection function can be improved... lol silly me.
put the _positionExtPrev = _positionExt; below the if blocks, its called everytime anyway lol, so no need for 3 declarations :P

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