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,18 +212,23 @@ DCCWaveform::DCCWaveform(byte preambleBits, bool isMain) {
void DCCWaveform::begin() {
for(const auto& md: TrackManager::getMainDrivers()) {
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 {
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 */
}
}
MotorDriver *md = TrackManager::getProgDriver();
if (md) {
if (rmtProgChannel) {
/* exchange prog channel - not supported yet */
DIAG(F("added pin %d to PROG channel"), md->getSignalPin());
rmtProgChannel->addPin(md->getSignalPin()); // add pin to existing prog channel
} else {
DIAG(F("new PROGchannel %d"), TrackManager::getProgDriver()->getSignalPin());
DIAG(F("new PROGchannel with pin %d"), TrackManager::getProgDriver()->getSignalPin());
rmtProgChannel = new RMTChannel(TrackManager::getProgDriver()->getSignalPin(), false);
}
}
}
void DCCWaveform::schedulePacket(const byte buffer[], byte byteCount, byte repeats) {