diff --git a/examples/Tutorials/D-Expert/15-RealPushButtons/15-RealPushButtons.ino b/examples/Tutorials/D-Expert/15-RealPushButtons/15-RealPushButtons.ino index c7bbd00..44eee77 100644 --- a/examples/Tutorials/D-Expert/15-RealPushButtons/15-RealPushButtons.ino +++ b/examples/Tutorials/D-Expert/15-RealPushButtons/15-RealPushButtons.ino @@ -94,7 +94,7 @@ void setup() { new SpanAccessory(); new DEV_Identify("PushButton LED","HomeSpan","123-ABC","20mA LED","0.9",0); - new DEV_DimmableLED(0,17,23,5,18); // NEW! added three extra arguments to specific the pin numbers for three SpanButtons() - see DEV_LED.h + new DEV_DimmableLED(0,17,23,5,18); // NEW! added three extra arguments to specify the pin numbers for three SpanButtons() - see DEV_LED.h } // end of setup() diff --git a/src/Utils.cpp b/src/Utils.cpp index 2c179a9..2686496 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -99,6 +99,7 @@ boolean PushButton::triggered(uint16_t shortTime, uint16_t longTime){ } else if(millis()>longAlarm){ // button is long-pressed + longAlarm=millis()+longTime; status=3; isLongPress=true; return(true); @@ -108,6 +109,11 @@ boolean PushButton::triggered(uint16_t shortTime, uint16_t longTime){ case 3: if(digitalRead(pin)) // button has been released after a long press status=0; + else if(millis()>longAlarm){ + longAlarm=millis()+longTime; + isLongPress=true; + return(true); + } break; }