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

faultpin is common only if it exists ; make code prettier

This commit is contained in:
Harald Barth 2021-02-20 13:50:39 +01:00
parent 6ebadbfc28
commit a7d8ed2b1e

View File

@ -39,10 +39,15 @@ void DCCWaveform::begin(MotorDriver * mainDriver, MotorDriver * progDriver) {
progTripValue = progDriver->mA2raw(TRIP_CURRENT_PROG); // need only calculate once hence static
mainTrack.setPowerMode(POWERMODE::OFF);
progTrack.setPowerMode(POWERMODE::OFF);
// Fault pin config for odd motor boards (example pololu)
MotorDriver::commonFaultPin = ((mainDriver->getFaultPin() == progDriver->getFaultPin())
&& (mainDriver->getFaultPin() != UNUSED_PIN));
// Only use PWM if both pins are PWM capable. Otherwise JOIN does not work
MotorDriver::usePWM= mainDriver->isPWMCapable() && progDriver->isPWMCapable();
MotorDriver::commonFaultPin = (mainDriver->getFaultPin() == progDriver->getFaultPin());
if (MotorDriver::usePWM) DIAG(F("\nWaveform using PWM pins for accuracy."));
else DIAG(F("\nWaveform accuracy limited by signal pin configuration."));
if (MotorDriver::usePWM)
DIAG(F("\nWaveform using PWM pins for accuracy."));
else
DIAG(F("\nWaveform accuracy limited by signal pin configuration."));
DCCTimer::begin(DCCWaveform::interruptHandler);
}