Skip to content

Commit f2cc75d

Browse files
committed
bug fix DigitalOut callback
1 parent 4660953 commit f2cc75d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/DigitalOut.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void DigitalOut::set() {
123123
if (m_isgpio)
124124
digitalWrite(m_pin, m_activeLow ? LOW : HIGH);
125125

126-
if (!m_lastState)
126+
if (!m_lastState && fn_rise != nullptr )
127127
fn_rise();
128128

129129
m_state = true;
@@ -134,7 +134,7 @@ void DigitalOut::reset() {
134134
if (m_isgpio)
135135
digitalWrite(m_pin, m_activeLow ? HIGH : LOW);
136136

137-
if (m_lastState)
137+
if (m_lastState && fn_fall != nullptr)
138138
fn_fall();
139139

140140
m_state = false;

0 commit comments

Comments
 (0)