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

enable more debug

This commit is contained in:
Harald Barth 2022-06-05 23:08:59 +02:00
parent 016bc37b53
commit 2d52d88688
2 changed files with 5 additions and 2 deletions

View File

@ -169,6 +169,7 @@ void MotorDriver::setDCSignal(byte speedcode) {
if (tSpeed <= 1) brake = 255;
else if (tSpeed >= 127) brake = 0;
else brake = 2 * (128-tSpeed);
DIAG(F("BrakePin=%d speedcode=%d"),brakePin,speedcode);
analogWrite(brakePin,brake);
setSignal(speedcode & 0x80);
}

View File

@ -136,7 +136,7 @@ void TrackManager::setDCSignal(int16_t cab, byte speedbyte) {
bool TrackManager::setTrackMode(byte trackToSet, TRACK_MODE mode, int16_t dcAddr) {
if (trackToSet>lastTrack || track[trackToSet]==NULL) return false;
//DIAG(F("Track=%c"),trackToSet+'A');
DIAG(F("Track=%c"),trackToSet+'A');
// DC tracks require a motorDriver that can set brake!
if ((mode==TRACK_MODE_DC || mode==TRACK_MODE_DCX)
&& !track[trackToSet]->brakeCanPWM()) {
@ -197,6 +197,8 @@ bool TrackManager::setTrackMode(byte trackToSet, TRACK_MODE mode, int16_t dcAddr
if (!canDo) {
DCCTimer::clearPWM();
}
if (MotorDriver::usePWM != canDo)
DIAG(F("HA mode changed from %d to %d"), MotorDriver::usePWM, canDo);
MotorDriver::usePWM=canDo;
@ -204,7 +206,7 @@ bool TrackManager::setTrackMode(byte trackToSet, TRACK_MODE mode, int16_t dcAddr
track[trackToSet]->setPower(
(mode==TRACK_MODE_MAIN || mode==TRACK_MODE_DC || mode==TRACK_MODE_DCX || mode==TRACK_MODE_EXT) ?
mainPowerGuess : POWERMODE::OFF);
//DIAG(F("TrackMode=%d"),mode);
DIAG(F("TrackMode=%d"),mode);
return true;
}