1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 21:01:25 +01:00

Reset counter prearation

This commit is contained in:
Asbelos 2020-06-06 11:11:03 +01:00
parent 5144eb6764
commit b2b6886b52
2 changed files with 5 additions and 0 deletions

View File

@ -6,6 +6,8 @@
DCCWaveform DCCWaveform::mainTrack(PREAMBLE_BITS_MAIN, true);
DCCWaveform DCCWaveform::progTrack(PREAMBLE_BITS_PROG, false);
void DCCWaveform::begin() {
Hardware::init();
Hardware::setCallback(58, interruptHandler);
@ -170,12 +172,14 @@ void DCCWaveform::interrupt2() {
transmitLength = pendingLength;
transmitRepeats = pendingRepeats;
packetPending = false;
sentResetsSincePacket=0;
}
else {
// Fortunately reset and idle packets are the same length
memcpy( transmitPacket, isMainTrack ? idlePacket : resetPacket, sizeof(idlePacket));
transmitLength = sizeof(idlePacket);
transmitRepeats = 0;
sentResetsSincePacket++;
}
}
}

View File

@ -48,6 +48,7 @@ class DCCWaveform {
void schedulePacket(const byte buffer[], byte byteCount, byte repeats);
bool schedulePacketWithAck(const byte buffer[], byte byteCount, byte repeats);
volatile bool packetPending;
volatile byte sentResetsSincePacket;
private: