Added support for configurable logging on the ESP32 platform. #10

Merged
Joe merged 5 commits from console_dev into main 2026-01-10 22:25:50 +00:00
Showing only changes of commit 3d87f2b530 - Show all commits

View file

@ -24,8 +24,10 @@
#include "SystemK.h"
#define DEBUG_PACKET_ENCODE
#define DEBUG_PACKET_DECODE
// Use these defines to enable detailed debug logging of packet encoding and decoding on the PSoC platform.
// Debug logging is always available on the ESP32 platform, and can be configured with the console.
//#define PSoC_DEBUG_PACKET_ENCODE
//#define PSoC_DEBUG_PACKET_DECODE
static const char *KLOG_TAG = "Protocols";
@ -220,7 +222,7 @@ TimedPulseTrain_T *PROTOCOLS_EncodePacket(TagPacket_T *packet)
break;
}
#ifdef DEBUG_PACKET_ENCODE
#if ((defined PSoC_DEBUG_PACKET_ENCODE) || (defined ESP_PLATFORM))
#ifdef ESP_PLATFORM
if (esp_log_level_get(KLOG_TAG) >= ESP_LOG_DEBUG)
#endif // ESP_PLATFORM
@ -228,7 +230,7 @@ TimedPulseTrain_T *PROTOCOLS_EncodePacket(TagPacket_T *packet)
KLOG_DEBUG(KLOG_TAG, "\nEncoded %s packet (%u):", ProtocolNameAsString(packet->protocol), result->count);
PrintPulseTrainToConsole(result);
}
#endif // DEBUG_PACKET_ENCODE
#endif // ((defined PSoC_DEBUG_PACKET_ENCODE) || (defined ESP_PLATFORM))
return result;
}
@ -333,7 +335,7 @@ DecodedPacket_T *PROTOCOLS_MaybeDecodePacket(TimedPulseTrain_T *packet)
result = TEST_MaybeDecodePacket(packet);
}
#ifdef DEBUG_PACKET_DECODE
#if ((defined PSoC_DEBUG_PACKET_DECODE) || (defined ESP_PLATFORM))
#ifdef ESP_PLATFORM
if (esp_log_level_get(KLOG_TAG) >= ESP_LOG_DEBUG)
#endif // ESP_PLATFORM
@ -359,7 +361,7 @@ DecodedPacket_T *PROTOCOLS_MaybeDecodePacket(TimedPulseTrain_T *packet)
PrintPulseTrainToConsole(packet);
}
}
#endif // DEBUG_PACKET_DECODE
#endif // ((defined PSoC_DEBUG_PACKET_DECODE) || (defined ESP_PLATFORM))
// Remember which receiver saw the packet.
if (result != NULL)