OneButton icon indicating copy to clipboard operation
OneButton copied to clipboard

Setting the attachDuringLongPress event interval

Open FransCouwberghs opened this issue 4 years ago • 0 comments

Is it possible to set the interval for the attachDuringLongPress event? I use two buttons to increase or decrease a number on a display. I use the same function for attachClick and attachDuringLongPress so one can increase/decrease with one digit or 'speed' true the setting by holding down the button. The 'speed' however is way to fast. What I do now is testing at the end of the function whether the button is in a isLongPressed()) state and delay a period:

if (btnIncrease.isLongPressed()){ delay(50);}

This works quite well, but I have a aversion for delay(). I was thinking of a function setLongPressInterval(int) (likewise setPressTicks(int)) to set the interval.

Keep up the good work!

FransCouwberghs avatar Apr 16 '21 02:04 FransCouwberghs