How to add more time delay switch button

Hi , i want to add more time to trigger off when button pressed.
i have been checked on button.cpp
but i changed value from 300 to 1000 but no affected
then how to change delay off time after button pressed??

Use the button to trigger a playlist that handles the delay then shuts them off.

which code to execute??

Click on the playlist button and you will see your options. :wink:

you mean on this settings??
i dont get it

i only found code on this presets


then what should i do?

void handleSwitch(uint8_t b)
// isButtonPressed() handles inverted/noninverted logic
if (buttonPressedBefore[b] != isButtonPressed(b)) {
buttonPressedTime[b] = millis() ;
buttonPressedBefore[b] = !buttonPressedBefore[b];

if (buttonLongPressed[b] == buttonPressedBefore[b]) return;

if (millis() - buttonPressedTime[b] > WLED_DEBOUNCE_THRESHOLD) { //fire edge event only after 50ms without change (debounce)
if (!buttonPressedBefore[b]) { // on → off
if (macroButton[b]) applyPreset( macroButton[b] , CALL_MODE_BUTTON_PRESET );
else { //turn on

    if (!bri) {toggleOnOff(); stateUpdated(CALL_MODE_BUTTON);}
} else {  // off -> on


 if (macroLongPress[b] ) applyPreset( macroLongPress[b]    ,  CALL_MODE_BUTTON_PRESET );
  else { //turn off
    if (bri) {toggleOnOff(); stateUpdated(CALL_MODE_BUTTON);}


which one should i modified
if i changed state of WLED_DEBOUNCE_THRESHOLD its must press 2 second , i just want to press 50ms by default and hold it for 2 seconds than back to preset

Playlist. Notice Duration…

1 Like

i have been tested its no delay after im released the pin

no one can help??