Restore original behavior for button 0.
This commit is contained in:
parent
3332375d7c
commit
6c52105ac7
@ -863,7 +863,7 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
static bool buttonLongPressed = false;
|
static bool buttonLongPressed = false;
|
||||||
static unsigned long buttonPressedTime = 0;
|
static unsigned long buttonPressedTime = 0;
|
||||||
static unsigned long buttonWaitTime = 0;
|
static unsigned long buttonWaitTime = 0;
|
||||||
bool handled = false;
|
bool handled = true;
|
||||||
|
|
||||||
//momentary button logic
|
//momentary button logic
|
||||||
if (isButtonPressed(b)) { //pressed
|
if (isButtonPressed(b)) { //pressed
|
||||||
@ -873,8 +873,10 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
|
|
||||||
if (now - buttonPressedTime > 600) { //long press
|
if (now - buttonPressedTime > 600) { //long press
|
||||||
buttonLongPressed = true;
|
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);
|
longPressAction(0);
|
||||||
handled = true;
|
//handled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (!isButtonPressed(b) && buttonPressedBefore) { //released
|
} else if (!isButtonPressed(b) && buttonPressedBefore) { //released
|
||||||
@ -901,11 +903,13 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
buttonPressedBefore = false;
|
buttonPressedBefore = false;
|
||||||
buttonLongPressed = 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) {
|
if (buttonWaitTime && now - buttonWaitTime > 350 && !buttonPressedBefore) {
|
||||||
buttonWaitTime = 0;
|
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);
|
shortPressAction(0);
|
||||||
handled = true;
|
//handled = false;
|
||||||
}
|
}
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
@ -258,15 +258,15 @@ void handleButton()
|
|||||||
WLED::instance().initAP(true);
|
WLED::instance().initAP(true);
|
||||||
} else if (!buttonLongPressed[b]) { //short press
|
} else if (!buttonLongPressed[b]) { //short press
|
||||||
//NOTE: this interferes with double click handling in usermods so it is commented out
|
//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
|
if (b == 0 && !macroDoublePress[b]) { //don't wait for double press on button 0 if no double press macro set
|
||||||
// shortPressAction(b);
|
shortPressAction(b);
|
||||||
//} else { //double press if less than 350 ms between current press and previous short press release (buttonWaitTime!=0)
|
} else { //double press if less than 350 ms between current press and previous short press release (buttonWaitTime!=0)
|
||||||
if (doublePress) {
|
if (doublePress) {
|
||||||
doublePressAction(b);
|
doublePressAction(b);
|
||||||
} else {
|
} else {
|
||||||
buttonWaitTime[b] = now;
|
buttonWaitTime[b] = now;
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
buttonPressedBefore[b] = false;
|
buttonPressedBefore[b] = false;
|
||||||
buttonLongPressed[b] = false;
|
buttonLongPressed[b] = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user