From df767aaa36d0e015f0a81b521296ef0cd1aacad6 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Tue, 2 Aug 2022 21:44:29 +0200 Subject: [PATCH] go back to idle/reset packet if nothing to do --- DCCRMT.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/DCCRMT.cpp b/DCCRMT.cpp index 0bad881..cc54274 100644 --- a/DCCRMT.cpp +++ b/DCCRMT.cpp @@ -198,12 +198,17 @@ 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 && dataRepeat == 0) { // we did run empty + rmt_fill_tx_items(channel, idle, idleLen, preambleLen-1); + return; // nothing to do about that + } + + // take care of incoming data if (dataReady) { // if we have new data, fill while preamble is running rmt_fill_tx_items(channel, data, dataLen, preambleLen-1); dataReady = false; } if (dataRepeat > 0) // if a repeat count was specified, work on that dataRepeat--; - return; } #endif //ESP32