1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-27 01:56:14 +01:00

Merge pull request #296 from DCC-EX:294-bug-report-ex-rail-signalsignalh-inverted

294-bug-report-ex-rail-signalsignalh-inverted
This commit is contained in:
peteGSX 2023-01-23 04:59:54 +10:00 committed by GitHub
commit f2aeb4069f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1076,11 +1076,23 @@ 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,redval);
}
if (amberpin) {
bool amberval=(rag==SIGNAL_AMBER);
if (!aHigh) amberval=!amberval;
IODevice::write(amberpin,amberval);
}
if (greenpin) {
bool greenval=(rag==SIGNAL_GREEN || rag==SIMAMBER);
if (!aHigh) greenval=!greenval;
IODevice::write(greenpin,greenval);
}
}
/* static */ bool RMFT2::isSignal(int16_t id,char rag) {