diff --git a/DCCRMT.cpp b/DCCRMT.cpp index 1ac1aa4..d9a7844 100644 --- a/DCCRMT.cpp +++ b/DCCRMT.cpp @@ -154,8 +154,8 @@ void RMTChannel::RMTprefill() { const byte transmitMask[] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; -//bool RMTChannel::RMTfillData(const byte buffer[], byte byteCount, byte repeatCount=0) { -int RMTChannel::RMTfillData(dccPacket packet) { +int RMTChannel::RMTfillData(const byte buffer[], byte byteCount, byte repeatCount=0) { + //int RMTChannel::RMTfillData(dccPacket packet) { // dataReady: Signals to then interrupt routine. It is set when // we have data in the channel buffer which can be copied out // to the HW. dataRepeat on the other hand signals back to @@ -165,16 +165,14 @@ int RMTChannel::RMTfillData(dccPacket packet) { return 1000; if (dataRepeat > 0) // we have still old work to do return dataRepeat; - if (DATA_LEN(packet.length) > maxDataLen) { // this would overun our allocated memory for data - DIAG(F("Can not convert DCC bytes # %d to DCC bits %d, buffer too small"), packet.length, maxDataLen); + if (DATA_LEN(byteCount) > maxDataLen) { // this would overun our allocated memory for data + DIAG(F("Can not convert DCC bytes # %d to DCC bits %d, buffer too small"), byteCount, maxDataLen); return -1; // something very broken, can not convert packet } - byte *buffer = packet.data; - // convert bytes to RMT stream of "bits" byte bitcounter = 0; - for(byte n=0; n #if defined(ARDUINO_ARCH_ESP32) -#include "DCCPacket.h" #include "driver/rmt.h" #include "soc/rmt_reg.h" #include "soc/rmt_struct.h" @@ -35,8 +34,8 @@ class RMTChannel { RMTChannel(byte pin, bool isMain); void IRAM_ATTR RMTinterrupt(); void RMTprefill(); - int RMTfillData(dccPacket packet); - //bool RMTfillData(const byte buffer[], byte byteCount, byte repeatCount); + //int RMTfillData(dccPacket packet); + int RMTfillData(const byte buffer[], byte byteCount, byte repeatCount); static RMTChannel mainRMTChannel; static RMTChannel progRMTChannel;