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

Caculare from preamble start instead

This commit is contained in:
Harald Barth 2024-09-28 21:35:28 +02:00
parent cbec612b0f
commit 212708d88f

View File

@ -163,9 +163,12 @@ void DCCWaveform::interrupt2() {
if (remainingPreambles==1) promotePendingPacket();
else if (isMainTrack && railcomActive) {
// cutout has ended so its now possible to poll the railcom detectors
if (remainingPreambles==5) railcomSampleWindow=true;
// requiredPreambles is one higher that preamble length so
// if preamble length is 16 then this evaluates to 5
if (remainingPreambles==(requiredPreambles-12)) railcomSampleWindow=true;
// cutout can be ended when read
else if (remainingPreambles==14) DCCTimer::ackRailcomTimer();
// see above for requiredPreambles
else if (remainingPreambles==(requiredPreambles-3)) DCCTimer::ackRailcomTimer();
}
// Update free memory diagnostic as we don't have anything else to do this time.
// Allow for checkAck and its called functions using 22 bytes more.