-
Notifications
You must be signed in to change notification settings - Fork 234
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
In the special input example, is it correct that click is fired first? #136
Comments
Same here. Adding a 100ms delay and a counter to the example code shows that the click event occurs within 300ms, perhaps related to debounce state changes? unsigned int counter = 0;
void loop() {
// read your own source of input:
bool isPressed = (digitalRead(PIN_INPUT) == LOW);
// call tick frequently with current push-state of the input
button->tick(isPressed);
Serial.println(counter);
counter++;
delay(100);
}
Thanks for your work :) |
Same here, tried to force tick in high or low state before running loop. Always fires click. |
Anyone has a (temp) fix for this? |
I've investigate a little bit in this issue, and it seems to be related to the int debouncedPinLevel = 0; I think this is related to the debounce timer, when the timer reaches the debounce value the case OneButton::OCS_INIT:
...
if (activeLevel) { // -1 trigger this condition !!!!
_newState(OneButton::OCS_DOWN);
...
}
break; Here is my troubleshooting setup:
log before the patch--- Terminal on /dev/ttyUSB0 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
activeLevel: -1
OCS_INIT
activeLevel: -1
OCS_INIT
activeLevel: -1
OCS_INIT
activeLevel: -1
OCS_INIT
activeLevel: -1
OCS_INIT
activeLevel: -1
OCS_INIT
activeLevel: -1
OCS_INIT
activeLevel: -1
OCS_INIT
activeLevel: 0
OCS_DOWN
activeLevel: 0
OCS_DOWN
activeLevel: 0
OCS_DOWN
activeLevel: 0
OCS_DOWN
activeLevel: 0
OCS_DOWN
activeLevel: 0
OCS_DOWN
activeLevel: 0
OCS_DOWN
activeLevel: 0
OCS_DOWN
activeLevel: 0
OCS_UP
activeLevel: 0
OCS_UP
activeLevel: 0
OCS_UP
activeLevel: 0
OCS_UP
activeLevel: 0
OCS_UP
activeLevel: 0
OCS_UP
activeLevel: 0
OCS_UP
activeLevel: 0
OCS_UP
activeLevel: 0
OCS_COUNT
activeLevel: 0
OCS_COUNT
activeLevel: 0
OCS_COUNT
activeLevel: 0
OCS_COUNT
activeLevel: 0
OCS_COUNT
activeLevel: 0
OCS_COUNT
activeLevel: 0
OCS_COUNT
activeLevel: 0
OCS_COUNT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0 log after the patch--- Terminal on /dev/ttyUSB0 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0
OCS_INIT
activeLevel: 0 |
My temp solution was: `/* callbacks Button 1 */ void callback_Class_OneButton_BUTTON1_click() But your solution @XavierBrassoud Seems to work fine. |
Please retest with the current version. |
The click event is fired as soon as the system starts.
This is an unintentional click event. Is this correct behavior?
I'm using an ESP32 board.
The text was updated successfully, but these errors were encountered: