@@ -19,7 +19,7 @@ ResetInput &ResetInput::getInstance() {
1919ResetInput::ResetInput ():
2020 _pin {PIN_RECONFIGURE}
2121 {
22- _pressed = false ;
22+ _expired = false ;
2323 _startPressed = 0 ;
2424 _fireEvent = false ;
2525 _pressedCustomCallback = nullptr ;
@@ -32,21 +32,19 @@ void ResetInput::begin() {
3232 pinMode (PIN_RECONFIGURE, INPUT_PULLUP);
3333#endif
3434 pinMode (LED_RECONFIGURE, OUTPUT);
35+ digitalWrite (LED_RECONFIGURE, LED_OFF);
3536
3637 attachInterrupt (digitalPinToInterrupt (PIN_RECONFIGURE),_pressedCallback, CHANGE);
3738}
3839
3940bool ResetInput::isEventFired () {
40- if (_pressed ){
41+ if (_startPressed != 0 ){
4142#if defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_SAMD_MKRWIFI1010)
4243 LEDFeedbackClass::getInstance ().stop ();
4344#endif
4445 if (micros () - _startPressed > RESET_HOLD_TIME){
45- #if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_GIGA)
46- digitalWrite (LED_RECONFIGURE, HIGH);
47- #else
48- digitalWrite (LED_RECONFIGURE, LOW);
49- #endif
46+ digitalWrite (LED_RECONFIGURE, LED_OFF);
47+ _expired = true ;
5048 }
5149 }
5250
@@ -71,21 +69,10 @@ void ResetInput::_pressedCallback() {
7169 LEDFeedbackClass::getInstance ().stop ();
7270#endif
7371 _startPressed = micros ();
74- _pressed = true ;
75- #if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_GIGA)
76- digitalWrite (LED_RECONFIGURE, LOW);
77- #else
78- digitalWrite (LED_RECONFIGURE, HIGH);
79- #endif
72+ digitalWrite (LED_RECONFIGURE, LED_ON);
8073 } else {
81- #if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_GIGA)
82- digitalWrite (LED_RECONFIGURE, HIGH);
83- #else
84- digitalWrite (LED_RECONFIGURE, LOW);
85- #endif
86-
87- _pressed = false ;
88- if (_startPressed != 0 && micros () - _startPressed > RESET_HOLD_TIME){
74+ digitalWrite (LED_RECONFIGURE, LED_OFF);
75+ if (_startPressed != 0 && _expired){
8976 _fireEvent = true ;
9077 }else {
9178 LEDFeedbackClass::getInstance ().restart ();
0 commit comments