mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-07-04 13:05:24 +02: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() {
|
void DCC::issueReminders() {
|
||||||
// if the main track transmitter still has a pending packet, skip this time around.
|
// 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
|
// 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++) {
|
for (int reg=0;reg<MAX_LOCOS;reg++) {
|
||||||
|
2
DCCEX.h
2
DCCEX.h
@ -38,7 +38,7 @@
|
|||||||
#include "LCN.h"
|
#include "LCN.h"
|
||||||
#include "freeMemory.h"
|
#include "freeMemory.h"
|
||||||
|
|
||||||
#if __has_include ( "myAutomation.h")
|
#if __has_include ("myAutomation.h") && __has_include ("RMFT.h")
|
||||||
#include "RMFT.h"
|
#include "RMFT.h"
|
||||||
#define RMFT_ACTIVE
|
#define RMFT_ACTIVE
|
||||||
#endif
|
#endif
|
||||||
|
@ -94,6 +94,7 @@ const byte bitMask[] = {0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
|
|||||||
DCCWaveform::DCCWaveform( byte preambleBits, bool isMain) {
|
DCCWaveform::DCCWaveform( byte preambleBits, bool isMain) {
|
||||||
isMainTrack = isMain;
|
isMainTrack = isMain;
|
||||||
packetPending = false;
|
packetPending = false;
|
||||||
|
reminderWindowOpen = false;
|
||||||
memcpy(transmitPacket, idlePacket, sizeof(idlePacket));
|
memcpy(transmitPacket, idlePacket, sizeof(idlePacket));
|
||||||
state = WAVE_START;
|
state = WAVE_START;
|
||||||
// The +1 below is to allow the preamble generator to create the stop bit
|
// The +1 below is to allow the preamble generator to create the stop bit
|
||||||
@ -222,6 +223,10 @@ void DCCWaveform::interrupt2() {
|
|||||||
//end of Byte
|
//end of Byte
|
||||||
bits_sent = 0;
|
bits_sent = 0;
|
||||||
bytes_sent++;
|
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 this is the last byte, prepere for next packet
|
||||||
if (bytes_sent >= transmitLength) {
|
if (bytes_sent >= transmitLength) {
|
||||||
// end of transmission buffer... repeat or switch to next message
|
// 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;
|
pendingLength = byteCount + 1;
|
||||||
pendingRepeats = repeats;
|
pendingRepeats = repeats;
|
||||||
packetPending = true;
|
packetPending = true;
|
||||||
|
reminderWindowOpen = false;
|
||||||
sentResetsSincePacket=0;
|
sentResetsSincePacket=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +82,7 @@ class DCCWaveform {
|
|||||||
}
|
}
|
||||||
void schedulePacket(const byte buffer[], byte byteCount, byte repeats);
|
void schedulePacket(const byte buffer[], byte byteCount, byte repeats);
|
||||||
volatile bool packetPending;
|
volatile bool packetPending;
|
||||||
|
volatile bool reminderWindowOpen;
|
||||||
volatile byte sentResetsSincePacket;
|
volatile byte sentResetsSincePacket;
|
||||||
volatile bool autoPowerOff=false;
|
volatile bool autoPowerOff=false;
|
||||||
void setAckBaseline(); //prog track only
|
void setAckBaseline(); //prog track only
|
||||||
|
Loading…
x
Reference in New Issue
Block a user