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

To Fix the first time pressed button detection #58

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

i0n-
Copy link

@i0n- i0n- commented Sep 15, 2021

Code work fine after the first press of the button.
When I press by the first time is not detected (failed or missing)... second one and beyond works fine.

With this little change work fine since the beginning.

My current test environment is with the flash button on NodeMCU (ESP8266) board

Code work fine after the first press of the button.
When I press by the first time is not detected (failed or missing)... second one and beyond works fine.

With this little change work fine since the beginning.

My current test environment is with the flash button on NodeMCU (ESP8266) board
@evert-arias evert-arias self-assigned this Oct 17, 2021
@evert-arias
Copy link
Owner

Hi @i0n-,
I haven't had time to take a look at this, but I will do it soon.

@jPerotto
Copy link

I found the same problem

The solution is:

Add start value of
_held_callback_called = false;

void EasyButtonBase::onPressedFor(uint32_t duration, EasyButtonBase::callback_t callback)
{
	_held_threshold = duration;
	_pressed_for_callback = callback;
	_held_callback_called = false;
}

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

3 participants