1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-27 01:56:14 +01:00

provide methods to access sentResetsSincePacket

This commit is contained in:
Harald Barth 2022-08-02 15:13:29 +02:00
parent 07600274f1
commit 6b2cd226e2

View File

@ -53,6 +53,21 @@ class DCCWaveform {
static DCCWaveform mainTrack;
static DCCWaveform progTrack;
inline void clearRepeats() { transmitRepeats=0; }
#ifndef ARDUINO_ARCH_ESP32
inline void clearResets() { sentResetsSincePacket=0; }
inline byte getResets() { return sentResetsSincePacket; }
#else
inline void clearResets() { resetPacketBase = isMainTrack ?
rmtMainChannel->packetCount() : rmtProgChannel->packetCount(); };
inline byte getResets() {
uint32_t packetcount = isMainTrack ?
rmtMainChannel->packetCount() : rmtProgChannel->packetCount();
uint32_t count = packetcount - resetPacketBase;
if ((count & 255) == 0) // no high bits set
return count;
return 255;
};
#endif
void schedulePacket(const byte buffer[], byte byteCount, byte repeats);
volatile byte sentResetsSincePacket;
bool getPacketPending();
@ -60,6 +75,8 @@ class DCCWaveform {
private:
#ifndef ARDUINO_ARCH_ESP32
volatile bool packetPending;
#else
volatile uint32_t resetPacketBase;
#endif
static void interruptHandler();
void interrupt2();