mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-24 05:11: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::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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user