From 5d8a4fe2a3fadfbec904f9069d62bb5f2a87343d Mon Sep 17 00:00:00 2001 From: openshwprojects <85486843+openshwprojects@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:32:04 +0100 Subject: [PATCH] Update drv_ddp.c --- src/driver/drv_ddp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/driver/drv_ddp.c b/src/driver/drv_ddp.c index 25b89acd0..8c5970d75 100644 --- a/src/driver/drv_ddp.c +++ b/src/driver/drv_ddp.c @@ -119,13 +119,22 @@ void DRV_DDP_CreateSocket_Receive() { addLogAdv(LOG_INFO, LOG_FEATURE_DDP,"Waiting for packets\n"); } +static char buffer[512]; void DDP_Parse(byte *data, int len) { if(len > 12) { byte r, g, b; r = data[10]; g = data[11]; b = data[12]; + + int bufferIdx = 0; + for (int i = 0; i < len && bufferIdx < sizeof(buffer) - 3; i++) { + bufferIdx += sprintf(&buffer[bufferIdx], "%02X", data[i]); + } + buffer[bufferIdx] = '\0'; + addLogAdv(LOG_INFO, LOG_FEATURE_DDP, "Packet: %s, Length: %d\n", buffer, len); + #if ENABLE_DRIVER_SM16703P if (spiLED.ready) { // Note that this is limited by DDP msgbuf size