-
Notifications
You must be signed in to change notification settings - Fork 17
Add getDirection()
support to ModulinoKnob
and example β‘
#34
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
Add getDirection()
support to ModulinoKnob
and example β‘
#34
Conversation
Added support for character and string-based input to `isPressed()` in `ModulinoButtons`, so it now accepts both index (0β2) and letter identifiers (`'A'`, `'B'`, `'C'`) matching the physical button labeling. Closes arduino-libraries#3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contribution!
Please, take a look to my review. Minor fixes
.gitignore
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this file.
It is already included in the PR #33
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this file :)
this modifies doesn't add any feature to the PR
src/Modulino.h
Outdated
@@ -255,12 +256,27 @@ class ModulinoKnob : public Module { | |||
} | |||
return ret; | |||
} | |||
int16_t get() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it.
it is already included in the PR #32
src/Modulino.h
Outdated
uint8_t buf[3]; | ||
auto res = read(buf, 3); | ||
if (res == false) { | ||
return 0; | ||
} | ||
get(buf); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
it is already included in the PR #32
@leonardocavagnis I apologize for creating problems with the files but I had accidentally merged the changes of PR #33 into the With commit 66200f1 this PR is affected to pull request is merged indirectly or is still processing updates. For this reason with commit cff95ab everything should be fixed correctly. I remain waiting for further developments. Enjoy π |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
π Description
This PR introduces support for detecting rotation direction in the
ModulinoKnob
class via a new method:getDirection()
returns1
for clockwise,-1
for counter-clockwise, and0
when no movement is detected (debounced).DEBOUNCE_DELAY
to avoid noisy reads.begin()
logic now initializes internal state (_lastPosition
,_lastDebounceTime
) accordingly.getDirection()
.π Related Work
Fixed #9