From 95c87919a8707c0f9cd5c23e492002d3281acc5e Mon Sep 17 00:00:00 2001 From: Phil Bolduc Date: Sun, 19 Sep 2021 12:11:57 -0700 Subject: [PATCH] return ok status code and free buffer --- wled00/DDP.cpp | 5 ++++- wled00/DDP.h | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/wled00/DDP.cpp b/wled00/DDP.cpp index 9c3818d9..c682232d 100644 --- a/wled00/DDP.cpp +++ b/wled00/DDP.cpp @@ -62,7 +62,7 @@ void copyRgbwToRgb(byte *destination, byte *source, uint16_t length) { uint8_t realtimeBrodacast(IPAddress client, uint16_t busLength, byte *rgbwData) { WiFiUDP ddpUdp; - + // calclate the number of UDP packets we need to send uint16_t channelCount = busLength * 3; uint16_t packetCount = channelCount / DDP_CHANNELS_PER_PACKET; @@ -120,4 +120,7 @@ uint8_t realtimeBrodacast(IPAddress client, uint16_t busLength, byte *rgbwData) channel += packetSize; } + + free(buffer); + return 0; } diff --git a/wled00/DDP.h b/wled00/DDP.h index b591ec32..82dd0cdc 100644 --- a/wled00/DDP.h +++ b/wled00/DDP.h @@ -2,3 +2,15 @@ #define DDP_PUSH_FLAG 0x01 #define DDP_TIMECODE_FLAG 0x10 + +// +// Send real time DDP UDP updates to the specified client +// +// client - the IP address to send to +// busLength - the number of pixels +// rgbwData - a buffer of at least busLength*4 bytes long +// +// Returns +// 0 - Ok +// 1 - could not allocate buffer +uint8_t realtimeBrodacast(IPAddress client, uint16_t busLength, byte *rgbwData);