1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 12:51:24 +01:00

when brake pin has inverted sense, honor that when running in DC mode as well

This commit is contained in:
Harald Barth 2022-07-04 23:15:02 +02:00
parent 0406ca69cf
commit 6687c6f46d

View File

@ -179,6 +179,8 @@ void MotorDriver::setDCSignal(byte speedcode) {
if (tSpeed <= 1) brake = 255;
else if (tSpeed >= 127) brake = 0;
else brake = 2 * (128-tSpeed);
if (invertBrake)
brake=255-brake;
analogWrite(brakePin,brake);
// as the port registers can be shadowed to get syncronized DCC signals
// we need to take care of that and we have to turn off interrupts during