From 996d0415810c8583bfdb9d350a9cec1989c568c5 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Fri, 14 Apr 2023 11:39:12 +0200 Subject: [PATCH] bugfix for art-net transmit art-net transmit was not sending out LEDs, but only transmitted headers repeatedly (thanks @troyhacks for noticing). Actually such problems can be found by newer compilers, so i've added the warning option to [esp32_idf_V4]. wled00/udp.cpp: In function 'uint8_t realtimeBroadcast(uint8_t, IPAddress, uint16_t, uint8_t*, uint8_t, bool)': wled00/udp.cpp:824:40: warning: declaration of 'byte buffer [12]' shadows a parameter [-Wshadow=compatible-local] byte buffer[ART_NET_HEADER_SIZE]; ^ wled00/udp.cpp:720:85: note: shadowed declaration is here uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, uint8_t *buffer, uint8_t bri, bool isRGBW) { --- platformio.ini | 1 + wled00/udp.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/platformio.ini b/platformio.ini index 873592413..a20dab2c3 100644 --- a/platformio.ini +++ b/platformio.ini @@ -247,6 +247,7 @@ lib_deps = platform = espressif32@5.2.0 platform_packages = build_flags = -g + -Wshadow=compatible-local ;; emit warning in case a local variable "shadows" another local one -DARDUINO_ARCH_ESP32 -DESP32 #-DCONFIG_LITTLEFS_FOR_IDF_3_2 -D CONFIG_ASYNC_TCP_USE_WDT=0 diff --git a/wled00/udp.cpp b/wled00/udp.cpp index 6d7d28202..afe7b3356 100644 --- a/wled00/udp.cpp +++ b/wled00/udp.cpp @@ -821,9 +821,9 @@ uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, uint8 } } - byte buffer[ART_NET_HEADER_SIZE]; - memcpy_P(buffer, ART_NET_HEADER, ART_NET_HEADER_SIZE); - ddpUdp.write(buffer, ART_NET_HEADER_SIZE); // This doesn't change. Hard coded ID, OpCode, and protocol version. + byte header_buffer[ART_NET_HEADER_SIZE]; + memcpy_P(header_buffer, ART_NET_HEADER, ART_NET_HEADER_SIZE); + ddpUdp.write(header_buffer, ART_NET_HEADER_SIZE); // This doesn't change. Hard coded ID, OpCode, and protocol version. ddpUdp.write(sequenceNumber & 0xFF); // sequence number. 1..255 ddpUdp.write(0x00); // physical - more an FYI, not really used for anything. 0..3 ddpUdp.write((currentPacket) & 0xFF); // Universe LSB. 1 full packet == 1 full universe, so just use current packet number.