From fb9170ab8b80564fba5fd915728dcb1ad7cd8ee4 Mon Sep 17 00:00:00 2001 From: peteGSX Date: Sun, 22 Jan 2023 19:25:00 +1000 Subject: [PATCH 1/2] SIGNAL/SIGNALH operating correctly --- EXRAIL2.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index f44f9dc..bf5b61a 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -1076,11 +1076,26 @@ int16_t RMFT2::getSignalSlot(int16_t id) { // Manage invert (HIGH on) pins bool aHigh=sigid & ACTIVE_HIGH_SIGNAL_FLAG; - + // set the three pins - if (redpin) IODevice::write(redpin,(rag==SIGNAL_RED || rag==SIMAMBER)^aHigh); - if (amberpin) IODevice::write(amberpin,(rag==SIGNAL_AMBER)^aHigh); - if (greenpin) IODevice::write(greenpin,(rag==SIGNAL_GREEN || rag==SIMAMBER)^aHigh); + if (redpin) { + bool redval=(rag==SIGNAL_RED || rag==SIMAMBER); + if (!aHigh) redval=!redval; + // IODevice::write(redpin,(rag==SIGNAL_RED || rag==SIMAMBER)^aHigh); + IODevice::write(redpin,redval); + } + if (amberpin) { + // IODevice::write(amberpin,(rag==SIGNAL_AMBER)^aHigh); + bool amberval=(rag==SIGNAL_AMBER); + if (!aHigh) amberval=!amberval; + IODevice::write(amberpin,amberval); + } + if (greenpin) { + // IODevice::write(greenpin,(rag==SIGNAL_GREEN || rag==SIMAMBER)^aHigh); + bool greenval=(rag==SIGNAL_GREEN || rag==SIMAMBER); + if (!aHigh) greenval=!greenval; + IODevice::write(greenpin,greenval); + } } /* static */ bool RMFT2::isSignal(int16_t id,char rag) { From aaf25d542618d348882c3ea241e6968731cf2a2f Mon Sep 17 00:00:00 2001 From: peteGSX Date: Mon, 23 Jan 2023 04:53:39 +1000 Subject: [PATCH 2/2] Remove excess comments --- EXRAIL2.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index bf5b61a..5f2bf8b 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -1081,17 +1081,14 @@ int16_t RMFT2::getSignalSlot(int16_t id) { if (redpin) { bool redval=(rag==SIGNAL_RED || rag==SIMAMBER); if (!aHigh) redval=!redval; - // IODevice::write(redpin,(rag==SIGNAL_RED || rag==SIMAMBER)^aHigh); IODevice::write(redpin,redval); } if (amberpin) { - // IODevice::write(amberpin,(rag==SIGNAL_AMBER)^aHigh); bool amberval=(rag==SIGNAL_AMBER); if (!aHigh) amberval=!amberval; IODevice::write(amberpin,amberval); } if (greenpin) { - // IODevice::write(greenpin,(rag==SIGNAL_GREEN || rag==SIMAMBER)^aHigh); bool greenval=(rag==SIGNAL_GREEN || rag==SIMAMBER); if (!aHigh) greenval=!greenval; IODevice::write(greenpin,greenval);