From 7bf3f4aee07e99e3b098250524b3319f6628eed5 Mon Sep 17 00:00:00 2001 From: Troy <5659019+troyhacks@users.noreply.github.com> Date: Thu, 7 Nov 2024 13:48:17 -0500 Subject: [PATCH] Fixes for ESP8266 --- wled00/bus_manager.cpp | 5 ++++- wled00/udp.cpp | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 5399ccc2..aa0c1f4c 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -474,8 +474,11 @@ BusNetwork::BusNetwork(BusConfig &bc, const ColorOrderMap &com) : Bus(bc.type, b break; } _UDPchannels = _rgbw ? 4 : 3; + #ifdef ESP32 _data = (byte*) heap_caps_calloc_prefer((bc.count * _UDPchannels)+15, sizeof(byte), 3, MALLOC_CAP_DEFAULT, MALLOC_CAP_SPIRAM); - + #else + _data = (byte*) calloc((bc.count * _UDPchannels)+15, sizeof(byte)); + #endif if (_data == nullptr) return; _len = bc.count; _colorOrder = bc.colorOrder; diff --git a/wled00/udp.cpp b/wled00/udp.cpp index 447a490a..f6749a65 100644 --- a/wled00/udp.cpp +++ b/wled00/udp.cpp @@ -774,7 +774,11 @@ uint8_t IRAM_ATTR realtimeBroadcast(uint8_t type, IPAddress client, uint16_t len // For some reason, this is faster outside of the case block... // - static byte *packet_buffer = (byte *) heap_caps_calloc_prefer(530, sizeof(byte), 2, MALLOC_CAP_DEFAULT, MALLOC_CAP_SPIRAM); // MALLOC_CAP_TCM seems to have alignment issues. + #ifdef ESP32 + static byte *packet_buffer = (byte *) heap_caps_calloc_prefer(530, sizeof(byte), 2, MALLOC_CAP_DEFAULT, MALLOC_CAP_SPIRAM); + #else + static byte *packet_buffer = (byte *) calloc(530, sizeof(byte)); + #endif if (packet_buffer[0] != 0x41) memcpy(packet_buffer, ART_NET_HEADER, 12); // copy in the Art-Net header if it isn't there already // Volumetric test code