From b030ca74810184c9742399f7b812dfa02a5e26ef Mon Sep 17 00:00:00 2001 From: cotestatnt Date: Sun, 19 Nov 2023 13:13:40 +0100 Subject: [PATCH] fix DigitalOut callback --- library.properties | 8 ++++---- src/DigitalOut.cpp | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/library.properties b/library.properties index de16825..df4a9c4 100644 --- a/library.properties +++ b/library.properties @@ -1,9 +1,9 @@ -name=DigitalSignals Arduino -version=0.1.2 +name=DigitalSignalsArduino +version=0.0.6 author=Tolentino Cotesta maintainer=Tolentino Cotesta -sentence=Arduino Digital Signal library +sentence=Digital Signal library for Arduino platform paragraph=Arduino Digital Signal let you to configure and control in clear and easy way digital signals with your Arduino board like push buttons, switches, relays (active low or active high), leds etc etc. category=Signal Input/Output url=https://github.com/cotestatnt/DigitalSignal -architectures=* +architectures=* \ No newline at end of file diff --git a/src/DigitalOut.cpp b/src/DigitalOut.cpp index c6789e9..163bb05 100644 --- a/src/DigitalOut.cpp +++ b/src/DigitalOut.cpp @@ -151,9 +151,11 @@ uint32_t DigitalOut::set() { m_isActive = true; // Execute callback function on rising edge - if (!m_lastState && (fn_rise != nullptr)) { + if (!m_lastState) { m_lastState = true; - fn_rise(this); + if (fn_rise != nullptr) { + fn_rise(this); + } } return millis(); } @@ -165,9 +167,11 @@ uint32_t DigitalOut::reset() { m_isActive = false; // Execute callback function on falling edge - if (m_lastState && (fn_fall != nullptr)) { + if (m_lastState ) { m_lastState = false; - fn_fall(this); + if (fn_fall != nullptr) { + fn_fall(this); + } } m_runState = RunStates::OFF; return millis();