Here is my code to replace what’s there now if you just want the input the do something when on or off (not momentary like it is by default). This calls the press and long-press macros.
void handleButton()
{
#ifdef BTNPIN
if (!buttonEnabled) return;
if (digitalRead(BTNPIN) == LOW) { //pressed
if (!buttonPressedBefore){
buttonPressedBefore = true;
applyMacro(macroButton); // input on
}
}
else if (digitalRead(BTNPIN) == HIGH && buttonPressedBefore) //released
{
applyMacro(macroLongPress);
buttonPressedBefore = false;
}
#endif
}