mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
Move railcom decisions into same block
This commit is contained in:
parent
212708d88f
commit
aebca646d9
|
@ -149,26 +149,28 @@ void DCCWaveform::interrupt2() {
|
||||||
if (remainingPreambles > 0 ) {
|
if (remainingPreambles > 0 ) {
|
||||||
state=WAVE_MID_1; // switch state to trigger LOW on next interrupt
|
state=WAVE_MID_1; // switch state to trigger LOW on next interrupt
|
||||||
|
|
||||||
// predict railcom cutout on next interrupt
|
|
||||||
cutoutNextTime= remainingPreambles==requiredPreambles
|
|
||||||
&& railcomActive
|
|
||||||
&& isMainTrack;
|
|
||||||
|
|
||||||
remainingPreambles--;
|
remainingPreambles--;
|
||||||
|
|
||||||
// As we get to the end of the preambles, open the reminder window.
|
// As we get to the end of the preambles, open the reminder window.
|
||||||
// This delays any reminder insertion until the last moment so
|
// This delays any reminder insertion until the last moment so
|
||||||
// that the reminder doesn't block a more urgent packet.
|
// that the reminder doesn't block a more urgent packet.
|
||||||
reminderWindowOpen=transmitRepeats==0 && remainingPreambles<4 && remainingPreambles>1;
|
reminderWindowOpen=transmitRepeats==0 && remainingPreambles<4 && remainingPreambles>1;
|
||||||
if (remainingPreambles==1) promotePendingPacket();
|
if (remainingPreambles==1)
|
||||||
|
promotePendingPacket();
|
||||||
else if (isMainTrack && railcomActive) {
|
else if (isMainTrack && railcomActive) {
|
||||||
// cutout has ended so its now possible to poll the railcom detectors
|
if (remainingPreambles==(requiredPreambles-1)) {
|
||||||
// requiredPreambles is one higher that preamble length so
|
// First look if we need to start a railcom cutout on next interrupt
|
||||||
// if preamble length is 16 then this evaluates to 5
|
cutoutNextTime= true;
|
||||||
if (remainingPreambles==(requiredPreambles-12)) railcomSampleWindow=true;
|
} else if (remainingPreambles==(requiredPreambles-12)) {
|
||||||
// cutout can be ended when read
|
// cutout has ended so its now possible to poll the railcom detectors
|
||||||
// see above for requiredPreambles
|
// requiredPreambles is one higher that preamble length so
|
||||||
else if (remainingPreambles==(requiredPreambles-3)) DCCTimer::ackRailcomTimer();
|
// if preamble length is 16 then this evaluates to 5
|
||||||
|
railcomSampleWindow=true;
|
||||||
|
} else if (remainingPreambles==(requiredPreambles-3)) {
|
||||||
|
// cutout can be ended when read
|
||||||
|
// see above for requiredPreambles
|
||||||
|
DCCTimer::ackRailcomTimer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update free memory diagnostic as we don't have anything else to do this time.
|
// 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.
|
// Allow for checkAck and its called functions using 22 bytes more.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user