Skip to content

Commit

Permalink
Merge branch 'devel-railcom2' of https://github.com/DCC-EX/CommandSta…
Browse files Browse the repository at this point in the history
…tion-EX into devel-railcom2
  • Loading branch information
Asbelos committed Sep 28, 2024
2 parents d8635de + f712f8f commit 0712eef
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
30 changes: 16 additions & 14 deletions DCCWaveform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,26 +149,28 @@ void DCCWaveform::interrupt2() {
if (remainingPreambles > 0 ) {
state=WAVE_MID_1; // switch state to trigger LOW on next interrupt

// predict railcom cutout on next interrupt
cutoutNextTime= remainingPreambles==requiredPreambles
&& railcomActive
&& isMainTrack;

remainingPreambles--;

// As we get to the end of the preambles, open the reminder window.
// This delays any reminder insertion until the last moment so
// that the reminder doesn't block a more urgent packet.
reminderWindowOpen=transmitRepeats==0 && remainingPreambles<4 && remainingPreambles>1;
if (remainingPreambles==1) promotePendingPacket();
reminderWindowOpen=transmitRepeats==0 && remainingPreambles<10 && remainingPreambles>1;
if (remainingPreambles==1)
promotePendingPacket();
else if (isMainTrack && railcomActive) {
// cutout has ended so its now possible to poll the railcom detectors
// 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
// see above for requiredPreambles
else if (remainingPreambles==(requiredPreambles-3)) DCCTimer::ackRailcomTimer();
if (remainingPreambles==(requiredPreambles-1)) {
// First look if we need to start a railcom cutout on next interrupt
cutoutNextTime= true;
} else if (remainingPreambles==(requiredPreambles-12)) {
// cutout has ended so its now possible to poll the railcom detectors
// requiredPreambles is one higher that preamble length so
// 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.
// Allow for checkAck and its called functions using 22 bytes more.
Expand Down
2 changes: 1 addition & 1 deletion GITHUB_SHA.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define GITHUB_SHA "devel-202409221903Z"
#define GITHUB_SHA "devel-railcom2-202409282036Z"

0 comments on commit 0712eef

Please sign in to comment.