From aebca646d9c7af5ed659089ce08f8b6db113c7d5 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sat, 28 Sep 2024 22:10:46 +0200 Subject: [PATCH 1/3] Move railcom decisions into same block --- DCCWaveform.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/DCCWaveform.cpp b/DCCWaveform.cpp index d61de9d..89d0804 100644 --- a/DCCWaveform.cpp +++ b/DCCWaveform.cpp @@ -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(); + 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. From 9e8c9d5cc7574104b8fc01f888ee7f0b4321038c Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sat, 28 Sep 2024 22:36:14 +0200 Subject: [PATCH 2/3] Make remider window 6 preamble bits bigger --- DCCWaveform.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DCCWaveform.cpp b/DCCWaveform.cpp index 89d0804..3247c05 100644 --- a/DCCWaveform.cpp +++ b/DCCWaveform.cpp @@ -154,7 +154,7 @@ void DCCWaveform::interrupt2() { // 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; + reminderWindowOpen=transmitRepeats==0 && remainingPreambles<10 && remainingPreambles>1; if (remainingPreambles==1) promotePendingPacket(); else if (isMainTrack && railcomActive) { From f712f8f367f3a1f7cdd5fbe9b613bbfb401c0eb7 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sat, 28 Sep 2024 22:37:25 +0200 Subject: [PATCH 3/3] tag it --- GITHUB_SHA.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index c9bb3bb..623f7f6 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "devel-202409221903Z" +#define GITHUB_SHA "devel-railcom2-202409282036Z"