diff --git a/DCCRMT.cpp b/DCCRMT.cpp index c6ffb60..0bad881 100644 --- a/DCCRMT.cpp +++ b/DCCRMT.cpp @@ -197,6 +197,7 @@ int RMTChannel::RMTfillData(const byte buffer[], byte byteCount, byte repeatCoun void IRAM_ATTR RMTChannel::RMTinterrupt() { //no rmt_tx_start(channel,true) as we run in loop mode //preamble is always loaded at beginning of buffer + packetCounter++; if (dataReady) { // if we have new data, fill while preamble is running rmt_fill_tx_items(channel, data, dataLen, preambleLen-1); dataReady = false; diff --git a/DCCRMT.h b/DCCRMT.h index 268c99e..45d3eef 100644 --- a/DCCRMT.h +++ b/DCCRMT.h @@ -41,6 +41,7 @@ class RMTChannel { return true; return dataReady; }; + inline uint32_t packetCount() { return packetCounter; }; private: @@ -54,6 +55,7 @@ class RMTChannel { rmt_item32_t *data; byte dataLen; byte maxDataLen; + uint32_t packetCounter = 0; // flags volatile bool dataReady = false; // do we have real data available or send idle volatile byte dataRepeat = 0;