diff --git a/DCCRMT.cpp b/DCCRMT.cpp index 631cc16..cbd9af6 100644 --- a/DCCRMT.cpp +++ b/DCCRMT.cpp @@ -194,8 +194,10 @@ int RMTChannel::RMTfillData(const byte buffer[], byte byteCount, byte repeatCoun setDCCBit1(data + bitcounter-1); // overwrite previous zero bit with one bit setEOT(data + bitcounter++); // EOT marker dataLen = bitcounter; + noInterrupts(); // keep dataReady and dataRepeat consistnet to each other dataReady = true; dataRepeat = repeatCount+1; // repeatCount of 0 means send once + interrupts(); return 0; } @@ -212,6 +214,8 @@ void IRAM_ATTR RMTChannel::RMTinterrupt() { 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) // all data should go out at least once + DIAG(F("Channel %d DCC signal lost data"), channel); } if (dataRepeat > 0) // if a repeat count was specified, work on that dataRepeat--; diff --git a/DCCWaveform.cpp b/DCCWaveform.cpp index e065648..4a99997 100644 --- a/DCCWaveform.cpp +++ b/DCCWaveform.cpp @@ -247,6 +247,9 @@ void DCCWaveform::schedulePacket(const byte buffer[], byte byteCount, byte repea pendingPacket[byteCount] = checksum; pendingLength = byteCount + 1; pendingRepeats = repeats; +// DIAG repeated commands (accesories) +// if (pendingRepeats > 0) +// DIAG(F("Repeats=%d on %s track"), pendingRepeats, isMainTrack ? "MAIN" : "PROG"); // The resets will be zero not only now but as well repeats packets into the future clearResets(repeats+1); { diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index 6238066..2b88c4b 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "devel-overcurrent-202307041424Z" +#define GITHUB_SHA "devel-overcurrent-202307061318Z" diff --git a/version.h b/version.h index e445bb1..93df891 100644 --- a/version.h +++ b/version.h @@ -4,8 +4,9 @@ #include "StringFormatter.h" -#define VERSION "4.2.62pre2" +#define VERSION "4.2.62pre3" // 4.2.62 - completely new overcurrent detection +// - ESP32 protect from race in RMT code // 4.2.61 - MAX_CURRENT restriction (caps motor shield value) // 4.2.60 - Add mDNS capability to ESP32 for autodiscovery // 4.2.59 - Fix: AP SSID was DCC_ instead of DCCEX_