mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-01 03:55:03 +01:00
add remainderWindowOpen to give immediate packets a better chance
This commit is contained in:
parent
79ce71c2f9
commit
4194dec343
2
DCC.cpp
2
DCC.cpp
|
@ -567,7 +567,7 @@ void DCC::loop() {
|
|||
|
||||
void DCC::issueReminders() {
|
||||
// if the main track transmitter still has a pending packet, skip this time around.
|
||||
if ( DCCWaveform::mainTrack.packetPending) return;
|
||||
if (!DCCWaveform::mainTrack.reminderWindowOpen) return;
|
||||
|
||||
// This loop searches for a loco in the speed table starting at nextLoco and cycling back around
|
||||
for (int reg=0;reg<MAX_LOCOS;reg++) {
|
||||
|
|
2
DCCEX.h
2
DCCEX.h
|
@ -38,7 +38,7 @@
|
|||
#include "LCN.h"
|
||||
#include "freeMemory.h"
|
||||
|
||||
#if __has_include ( "myAutomation.h")
|
||||
#if __has_include ("myAutomation.h") && __has_include ("RMFT.h")
|
||||
#include "RMFT.h"
|
||||
#define RMFT_ACTIVE
|
||||
#endif
|
||||
|
|
|
@ -94,6 +94,7 @@ const byte bitMask[] = {0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
|
|||
DCCWaveform::DCCWaveform( byte preambleBits, bool isMain) {
|
||||
isMainTrack = isMain;
|
||||
packetPending = false;
|
||||
reminderWindowOpen = false;
|
||||
memcpy(transmitPacket, idlePacket, sizeof(idlePacket));
|
||||
state = WAVE_START;
|
||||
// The +1 below is to allow the preamble generator to create the stop bit
|
||||
|
@ -222,6 +223,10 @@ void DCCWaveform::interrupt2() {
|
|||
//end of Byte
|
||||
bits_sent = 0;
|
||||
bytes_sent++;
|
||||
// if this is the byte before last byte, open reminder window
|
||||
if (bytes_sent == transmitLength && transmitRepeats == 0 && !packetPending) {
|
||||
reminderWindowOpen = true;
|
||||
}
|
||||
// if this is the last byte, prepere for next packet
|
||||
if (bytes_sent >= transmitLength) {
|
||||
// end of transmission buffer... repeat or switch to next message
|
||||
|
@ -270,6 +275,7 @@ void DCCWaveform::schedulePacket(const byte buffer[], byte byteCount, byte repea
|
|||
pendingLength = byteCount + 1;
|
||||
pendingRepeats = repeats;
|
||||
packetPending = true;
|
||||
reminderWindowOpen = false;
|
||||
sentResetsSincePacket=0;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ class DCCWaveform {
|
|||
}
|
||||
void schedulePacket(const byte buffer[], byte byteCount, byte repeats);
|
||||
volatile bool packetPending;
|
||||
volatile bool reminderWindowOpen;
|
||||
volatile byte sentResetsSincePacket;
|
||||
volatile bool autoPowerOff=false;
|
||||
void setAckBaseline(); //prog track only
|
||||
|
|
Loading…
Reference in New Issue
Block a user