mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-24 21:21:24 +01:00
Reset counter prearation
This commit is contained in:
parent
5144eb6764
commit
b2b6886b52
@ -6,6 +6,8 @@
|
|||||||
DCCWaveform DCCWaveform::mainTrack(PREAMBLE_BITS_MAIN, true);
|
DCCWaveform DCCWaveform::mainTrack(PREAMBLE_BITS_MAIN, true);
|
||||||
DCCWaveform DCCWaveform::progTrack(PREAMBLE_BITS_PROG, false);
|
DCCWaveform DCCWaveform::progTrack(PREAMBLE_BITS_PROG, false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void DCCWaveform::begin() {
|
void DCCWaveform::begin() {
|
||||||
Hardware::init();
|
Hardware::init();
|
||||||
Hardware::setCallback(58, interruptHandler);
|
Hardware::setCallback(58, interruptHandler);
|
||||||
@ -170,12 +172,14 @@ void DCCWaveform::interrupt2() {
|
|||||||
transmitLength = pendingLength;
|
transmitLength = pendingLength;
|
||||||
transmitRepeats = pendingRepeats;
|
transmitRepeats = pendingRepeats;
|
||||||
packetPending = false;
|
packetPending = false;
|
||||||
|
sentResetsSincePacket=0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Fortunately reset and idle packets are the same length
|
// Fortunately reset and idle packets are the same length
|
||||||
memcpy( transmitPacket, isMainTrack ? idlePacket : resetPacket, sizeof(idlePacket));
|
memcpy( transmitPacket, isMainTrack ? idlePacket : resetPacket, sizeof(idlePacket));
|
||||||
transmitLength = sizeof(idlePacket);
|
transmitLength = sizeof(idlePacket);
|
||||||
transmitRepeats = 0;
|
transmitRepeats = 0;
|
||||||
|
sentResetsSincePacket++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ class DCCWaveform {
|
|||||||
void schedulePacket(const byte buffer[], byte byteCount, byte repeats);
|
void schedulePacket(const byte buffer[], byte byteCount, byte repeats);
|
||||||
bool schedulePacketWithAck(const byte buffer[], byte byteCount, byte repeats);
|
bool schedulePacketWithAck(const byte buffer[], byte byteCount, byte repeats);
|
||||||
volatile bool packetPending;
|
volatile bool packetPending;
|
||||||
|
volatile byte sentResetsSincePacket;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user