1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-30 03:26:13 +01:00

special treatment for Pololu board

This commit is contained in:
Harald Barth 2020-11-01 10:16:29 +01:00
parent 34f3abedaf
commit d248cccf81

View File

@ -55,6 +55,12 @@ MotorDriver::MotorDriver(byte power_pin, byte signal_pin, byte signal_pin2, int8
} }
void MotorDriver::setPower(bool on) { void MotorDriver::setPower(bool on) {
if (brakePin == -4 && on) {
// toggle brake before turning power on - resets overcurrent error
// on the Pololu board if brake is wired to ^D2.
setBrake(true);
setBrake(false);
}
WritePin(powerPin, on ? HIGH : LOW); WritePin(powerPin, on ? HIGH : LOW);
} }