Fixes for ESP8266

This commit is contained in:
Troy
2024-11-07 13:48:17 -05:00
parent e9ce495d83
commit 7bf3f4aee0
2 changed files with 9 additions and 2 deletions

View File

@@ -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;

View File

@@ -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