mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-23 21:01:25 +01:00
when brake pin has inverted sense, honor that when running in DC mode as well
This commit is contained in:
parent
0406ca69cf
commit
6687c6f46d
@ -179,6 +179,8 @@ void MotorDriver::setDCSignal(byte speedcode) {
|
|||||||
if (tSpeed <= 1) brake = 255;
|
if (tSpeed <= 1) brake = 255;
|
||||||
else if (tSpeed >= 127) brake = 0;
|
else if (tSpeed >= 127) brake = 0;
|
||||||
else brake = 2 * (128-tSpeed);
|
else brake = 2 * (128-tSpeed);
|
||||||
|
if (invertBrake)
|
||||||
|
brake=255-brake;
|
||||||
analogWrite(brakePin,brake);
|
analogWrite(brakePin,brake);
|
||||||
// as the port registers can be shadowed to get syncronized DCC signals
|
// 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
|
// we need to take care of that and we have to turn off interrupts during
|
||||||
|
Loading…
Reference in New Issue
Block a user