-
Notifications
You must be signed in to change notification settings - Fork 16
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
MultiButton - ClickUp Debounce not handled? #10
Comments
@sergeyken You're correct. When a switch is released, it immediately indicates Note that any bounces that follow (during the 'turn off') are debounced, but they will be debounced as being part of a 'potential turn on' (which will subsequently be 'dismissed' as being a glitch). 'Graphical' example:
This behavior leads to faster response times when using 'normal' mechanical switches, which was my original use-case and why I implemented it like this. For the use-case where turning off might in itself be glitchy, i.e. where a short 'off glitch' should not be treated as turning off, I agree that the current implementation is not ideal. In practice, I've also used the library with a capacitive touch system (which is a bit glitchy like that) and it worked just fine for me, but YMMV. |
OK, thank you for this explanation. Maybe, this happens rarely, but the situation like this one: |
I've used this MultiButton code to teach my grandkid who's learning C++, and Arduino. That's why I've noticed this possible misbehavior. I recommended him to split the original MultiButton into two separate classes:
|
Nice! Indeed, splitting them like that makes perfect sense. Especially as a learning experience, it's interesting to build something like this yourself :) I'll leave this issue open for now, in case others run into something similar. I'll perhaps fix it myself some day. |
Hello,
After looking into the source of MultiButton.h I'm under impression, that debouncing is done only for pressing button, but not for its releasing, isn't it?
At first moment the button is !pressed, after _state==StatePressed there is a change: _state=StateClickUp; _new=true;
The call to isReleased() returns (_new && _state == StateClickUp) which is true at this moment.
No check for DEBOUNCE_DELAY is performed at this situation.
Please, correct me if I am wrong?
The text was updated successfully, but these errors were encountered: