@@ -19,7 +19,7 @@ ResetInput &ResetInput::getInstance() {
19
19
ResetInput::ResetInput ():
20
20
_pin {PIN_RECONFIGURE}
21
21
{
22
- _pressed = false ;
22
+ _expired = false ;
23
23
_startPressed = 0 ;
24
24
_fireEvent = false ;
25
25
_pressedCustomCallback = nullptr ;
@@ -32,21 +32,19 @@ void ResetInput::begin() {
32
32
pinMode (PIN_RECONFIGURE, INPUT_PULLUP);
33
33
#endif
34
34
pinMode (LED_RECONFIGURE, OUTPUT);
35
+ digitalWrite (LED_RECONFIGURE, LED_OFF);
35
36
36
37
attachInterrupt (digitalPinToInterrupt (PIN_RECONFIGURE),_pressedCallback, CHANGE);
37
38
}
38
39
39
40
bool ResetInput::isEventFired () {
40
- if (_pressed ){
41
+ if (_startPressed != 0 ){
41
42
#if defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_SAMD_MKRWIFI1010)
42
43
LEDFeedbackClass::getInstance ().stop ();
43
44
#endif
44
45
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 ;
50
48
}
51
49
}
52
50
@@ -71,21 +69,10 @@ void ResetInput::_pressedCallback() {
71
69
LEDFeedbackClass::getInstance ().stop ();
72
70
#endif
73
71
_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);
80
73
} 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){
89
76
_fireEvent = true ;
90
77
}else {
91
78
LEDFeedbackClass::getInstance ().restart ();
0 commit comments