evert-arias / EasyButton

Arduino library for debouncing momentary contact switches, detect press, release, long press and sequences with event definitions and callbacks.
https://easybtn.earias.me
MIT License
452 stars 63 forks source link

Feature request: Reset pressed time. #67

Open JotarOne opened 2 years ago

JotarOne commented 2 years ago

I have a case where I am using two buttons. I am using "pressedFor" to trigger long press and if i press both buttons I can get an "extra" long press function. My issue is that when i release one of the buttons, the other one triggers my "single button long press". A function to reset the pressed time of the "other" button would force the "other" button to wait the whole allotted time again before pressedFor returns true.

Example:

void EasyButtonBase::resetTime()
{
    _last_change = millis();
} 

Thanks for a good, usable library!