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

RMFT SIGNAL macro to allow for RGB LEDs.

The SIGNAL macro has been changed to allow for use of RGB LEDs.  Connect R and G pins, and assign as SIGNAL(redpin,0,greenpin).  Then if amber is requested, the macro will set red and green on at the same time.
This commit is contained in:
Neil McKechnie 2021-08-29 12:14:23 +01:00
parent 1bb7b5cc77
commit afe9141671

View File

@ -678,9 +678,10 @@ void RMFT2::kill(const FSH * reason, int operand) {
if (redpin!=id)continue;
byte amberpin=GET_OPERAND(2);
byte greenpin=GET_OPERAND(3);
IODevice::write(redpin,red);
// If amberpin is zero, synthesise amber from red+green
IODevice::write(redpin,red || (amber && (amberpin==0)));
if (amberpin) IODevice::write(amberpin,amber);
if (greenpin) IODevice::write(amberpin,green);
if (greenpin) IODevice::write(amberpin,green || (amber && (amberpin==0)));
return;
}
}