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

Protect Uno user from choosing DC(X)

This commit is contained in:
Harald Barth 2023-08-02 01:02:46 +02:00
parent 415e756020
commit e3ac3a8ddf

View File

@ -192,11 +192,16 @@ bool TrackManager::setTrackMode(byte trackToSet, TRACK_MODE mode, int16_t dcAddr
//DIAG(F("Track=%c Mode=%d"),trackToSet+'A', mode);
// DC tracks require a motorDriver that can set brake!
if ((mode==TRACK_MODE_DC || mode==TRACK_MODE_DCX)
&& !track[trackToSet]->brakeCanPWM()) {
DIAG(F("Brake pin can't PWM: No DC"));
return false;
}
if (mode==TRACK_MODE_DC || mode==TRACK_MODE_DCX) {
#if defined(ARDUINO_AVR_UNO)
DIAG(F("Uno has no PWM timers available for DC"));
return false;
#endif
if (!track[trackToSet]->brakeCanPWM()) {
DIAG(F("Brake pin can't PWM: No DC"));
return false;
}
}
#ifdef ARDUINO_ARCH_ESP32
// remove pin from MUX matrix and turn it off