diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index 9bf1f27ba..4faf4fc40 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -11,6 +11,10 @@ #include #include +#if ARCH_PORTDUINO +#include "PortduinoGlue.h" +#include "meshUtils.h" +#endif void LockingArduinoHal::spiBeginTransaction() { spiLock->lock(); @@ -390,6 +394,11 @@ void RadioLibInterface::handleReceiveInterrupt() #endif int state = iface->readData((uint8_t *)&radioBuffer, length); +#if ARCH_PORTDUINO + if (settingsMap[logoutputlevel] == level_trace) { + printBytes("Raw incoming packet: ", (uint8_t *)&radioBuffer, length); + } +#endif if (state != RADIOLIB_ERR_NONE) { LOG_ERROR("ignoring received packet due to error=%d", state); rxBad++; diff --git a/src/meshUtils.cpp b/src/meshUtils.cpp index d211f2922..ea2ba641b 100644 --- a/src/meshUtils.cpp +++ b/src/meshUtils.cpp @@ -61,15 +61,13 @@ char *strnstr(const char *s, const char *find, size_t slen) void printBytes(const char *label, const uint8_t *p, size_t numbytes) { int labelSize = strlen(label); - if (labelSize < 100 && numbytes < 64) { - char *messageBuffer = new char[labelSize + (numbytes * 3) + 2]; - strncpy(messageBuffer, label, labelSize); - for (size_t i = 0; i < numbytes; i++) - snprintf(messageBuffer + labelSize + i * 3, 4, " %02x", p[i]); - strcpy(messageBuffer + labelSize + numbytes * 3, "\n"); - LOG_DEBUG(messageBuffer); - delete[] messageBuffer; - } + char *messageBuffer = new char[labelSize + (numbytes * 3) + 2]; + strncpy(messageBuffer, label, labelSize); + for (size_t i = 0; i < numbytes; i++) + snprintf(messageBuffer + labelSize + i * 3, 4, " %02x", p[i]); + strcpy(messageBuffer + labelSize + numbytes * 3, "\n"); + LOG_DEBUG(messageBuffer); + delete[] messageBuffer; } bool memfll(const uint8_t *mem, uint8_t find, size_t numbytes)