mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-23 12:51:24 +01:00
Merge branch 'devel-esp32-progfix' into devel
This commit is contained in:
commit
6cc3b4c6bf
@ -72,15 +72,19 @@ void DCCACK::Setup(int cv, byte byteValueOrBitnum, ackOp const program[], ACK_C
|
|||||||
// then unjoin if necessary. This requires that the joined flag is
|
// then unjoin if necessary. This requires that the joined flag is
|
||||||
// cleared when the prog track is removed.
|
// cleared when the prog track is removed.
|
||||||
ackManagerRejoin=TrackManager::isJoined();
|
ackManagerRejoin=TrackManager::isJoined();
|
||||||
|
//DIAG(F("Joined is %d"), ackManagerRejoin);
|
||||||
if (ackManagerRejoin) {
|
if (ackManagerRejoin) {
|
||||||
// Change from JOIN must zero resets packet.
|
// Change from JOIN must zero resets packet.
|
||||||
TrackManager::setJoin(false);
|
TrackManager::setJoin(false);
|
||||||
DCCWaveform::progTrack.clearResets();
|
DCCWaveform::progTrack.clearResets();
|
||||||
}
|
}
|
||||||
|
|
||||||
progDriver=TrackManager::getProgDriver();
|
progDriver=TrackManager::getProgDriver();
|
||||||
|
//DIAG(F("Progdriver is %d"), progDriver);
|
||||||
if (progDriver==NULL) {
|
if (progDriver==NULL) {
|
||||||
TrackManager::setJoin(ackManagerRejoin);
|
if (ackManagerRejoin) {
|
||||||
|
DIAG(F("Joined but no Prog track"));
|
||||||
|
TrackManager::setJoin(false);
|
||||||
|
}
|
||||||
callback(-3); // we dont have a prog track!
|
callback(-3); // we dont have a prog track!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -356,17 +356,24 @@ bool TrackManager::setTrackMode(byte trackToSet, TRACK_MODE mode, int16_t dcAddr
|
|||||||
applyDCSpeed(trackToSet);
|
applyDCSpeed(trackToSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turn off power if we changed the mode of this track
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
if (mode != oldmode)
|
|
||||||
track[trackToSet]->setPower(POWERMODE::OFF);
|
|
||||||
streamTrackState(NULL,trackToSet);
|
|
||||||
|
|
||||||
#ifndef DISABLE_PROG
|
#ifndef DISABLE_PROG
|
||||||
// If no prog track exists, the join flag should not say that
|
if (tempProgTrack == trackToSet && oldmode & TRACK_MODE_MAIN && !(mode & TRACK_MODE_PROG)) {
|
||||||
// the prog track is joined either, so clear flag here
|
// If we just take away the prog track, the join should not
|
||||||
if (getProgDriver() == NULL) progTrackSyncMain=false;
|
// be active either. So do in effect an unjoin
|
||||||
|
//DIAG(F("Unsync"));
|
||||||
|
tempProgTrack = MAX_TRACKS+1;
|
||||||
|
progTrackSyncMain=false;
|
||||||
|
if (joinRelay!=UNUSED_PIN) digitalWrite(joinRelay,LOW);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
// Turn off power if we changed the mode of this track
|
||||||
|
if (mode != oldmode) {
|
||||||
|
track[trackToSet]->setPower(POWERMODE::OFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
streamTrackState(NULL,trackToSet);
|
||||||
//DIAG(F("TrackMode=%d"),mode);
|
//DIAG(F("TrackMode=%d"),mode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user