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

ESP32 DCCWaveform::begin() bugfix for prog

This commit is contained in:
Harald Barth 2022-08-04 01:20:33 +02:00
parent 87fd1b887e
commit 7bad16dc59

View File

@ -212,17 +212,22 @@ DCCWaveform::DCCWaveform(byte preambleBits, bool isMain) {
void DCCWaveform::begin() { void DCCWaveform::begin() {
for(const auto& md: TrackManager::getMainDrivers()) { for(const auto& md: TrackManager::getMainDrivers()) {
if(rmtMainChannel) { if(rmtMainChannel) {
/* rmtMainChannel->addPin(md->getSignalPin); // add pin to existing main channel */ DIAG(F("added pin %d to MAIN channel"), md->getSignalPin());
rmtMainChannel->addPin(md->getSignalPin()); // add pin to existing main channel
} else { } else {
DIAG(F("new MAIN channel %d"), md->getSignalPin()); DIAG(F("new MAIN channel with pin %d"), md->getSignalPin());
rmtMainChannel = new RMTChannel(md->getSignalPin(), true); /* create new main channel */ rmtMainChannel = new RMTChannel(md->getSignalPin(), true); /* create new main channel */
} }
} }
if (rmtProgChannel) { MotorDriver *md = TrackManager::getProgDriver();
/* exchange prog channel - not supported yet */ if (md) {
} else { if (rmtProgChannel) {
DIAG(F("new PROGchannel %d"), TrackManager::getProgDriver()->getSignalPin()); DIAG(F("added pin %d to PROG channel"), md->getSignalPin());
rmtProgChannel = new RMTChannel(TrackManager::getProgDriver()->getSignalPin(), false); rmtProgChannel->addPin(md->getSignalPin()); // add pin to existing prog channel
} else {
DIAG(F("new PROGchannel with pin %d"), TrackManager::getProgDriver()->getSignalPin());
rmtProgChannel = new RMTChannel(TrackManager::getProgDriver()->getSignalPin(), false);
}
} }
} }