diff --git a/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h b/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h index 0c67e18b..383accc5 100644 --- a/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h +++ b/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h @@ -863,7 +863,7 @@ class FourLineDisplayUsermod : public Usermod { static bool buttonLongPressed = false; static unsigned long buttonPressedTime = 0; static unsigned long buttonWaitTime = 0; - bool handled = false; + bool handled = true; //momentary button logic if (isButtonPressed(b)) { //pressed @@ -873,8 +873,10 @@ class FourLineDisplayUsermod : public Usermod { if (now - buttonPressedTime > 600) { //long press buttonLongPressed = true; + //TODO: handleButton() handles button 0 without preset in a different way for double click + //so we need to override with same behaviour longPressAction(0); - handled = true; + //handled = false; } } else if (!isButtonPressed(b) && buttonPressedBefore) { //released @@ -901,11 +903,13 @@ class FourLineDisplayUsermod : public Usermod { buttonPressedBefore = false; buttonLongPressed = false; } - // if 450ms elapsed since last press/release it is a short press + // if 350ms elapsed since last press/release it is a short press if (buttonWaitTime && now - buttonWaitTime > 350 && !buttonPressedBefore) { buttonWaitTime = 0; + //TODO: handleButton() handles button 0 without preset in a different way for double click + //so we need to override with same behaviour shortPressAction(0); - handled = true; + //handled = false; } return handled; } diff --git a/wled00/button.cpp b/wled00/button.cpp index d7ec7609..f5600654 100644 --- a/wled00/button.cpp +++ b/wled00/button.cpp @@ -258,15 +258,15 @@ void handleButton() WLED::instance().initAP(true); } else if (!buttonLongPressed[b]) { //short press //NOTE: this interferes with double click handling in usermods so it is commented out - //if (b == 0 && !macroDoublePress[b]) { //don't wait for double press on button 0 if no double press macro set - // shortPressAction(b); - //} else { //double press if less than 350 ms between current press and previous short press release (buttonWaitTime!=0) + if (b == 0 && !macroDoublePress[b]) { //don't wait for double press on button 0 if no double press macro set + shortPressAction(b); + } else { //double press if less than 350 ms between current press and previous short press release (buttonWaitTime!=0) if (doublePress) { doublePressAction(b); } else { buttonWaitTime[b] = now; } - //} + } } buttonPressedBefore[b] = false; buttonLongPressed[b] = false;