mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-24 13:21:23 +01:00
prevent usage of pins for DC than can not do PWM
This commit is contained in:
parent
1c78792dda
commit
06e7ad5c53
@ -1 +1 @@
|
|||||||
#define GITHUB_SHA "TM-PORTX-20220524"
|
#define GITHUB_SHA "TM-PORTX-20220525"
|
||||||
|
@ -111,8 +111,8 @@ class MotorDriver {
|
|||||||
virtual int getCurrentRawInInterrupt();
|
virtual int getCurrentRawInInterrupt();
|
||||||
virtual unsigned int raw2mA( int raw);
|
virtual unsigned int raw2mA( int raw);
|
||||||
virtual int mA2raw( unsigned int mA);
|
virtual int mA2raw( unsigned int mA);
|
||||||
inline bool canBrake() {
|
inline bool brakeCanPWM() {
|
||||||
return brakePin!=UNUSED_PIN;
|
return ((brakePin!=UNUSED_PIN) && (digitalPinToTimer(brakePin)));
|
||||||
}
|
}
|
||||||
inline int getRawCurrentTripValue() {
|
inline int getRawCurrentTripValue() {
|
||||||
return rawCurrentTripValue;
|
return rawCurrentTripValue;
|
||||||
|
@ -139,8 +139,8 @@ bool TrackManager::setTrackMode(byte trackToSet, TRACK_MODE mode, int16_t dcAddr
|
|||||||
//DIAG(F("Track=%c"),trackToSet+'A');
|
//DIAG(F("Track=%c"),trackToSet+'A');
|
||||||
// DC tracks require a motorDriver that can set brake!
|
// DC tracks require a motorDriver that can set brake!
|
||||||
if ((mode==TRACK_MODE_DC || mode==TRACK_MODE_DCX)
|
if ((mode==TRACK_MODE_DC || mode==TRACK_MODE_DCX)
|
||||||
&& !track[trackToSet]->canBrake()) {
|
&& !track[trackToSet]->brakeCanPWM()) {
|
||||||
DIAG(F("No brake:no DC"));
|
DIAG(F("Brake pin can't PWM: No DC"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user