Fix ArtNet compilation on ESP32

This commit is contained in:
Theo Arends 2022-11-16 10:47:55 +01:00
parent d8d191b1c7
commit b92d5ab12c
1 changed files with 7 additions and 7 deletions

View File

@ -145,9 +145,9 @@ void ArtNetProcessPacket(uint8_t * buf, size_t len) {
if (artnet_conf.matrix) { if (artnet_conf.matrix) {
// Ws2812 led strip // Ws2812 led strip
size_t pix_size = Ws2812StripGetPixelSize(); size_t pix_size = Ws2812StripGetPixelSize();
datalen = datalen - (datalen % pix_size); datalen = datalen - (datalen % pix_size);
if (artnet_conf.alt && (row % 2)) { if (artnet_conf.alt && (row % 2)) {
for (int32_t i = idx, j = idx + datalen - pix_size; i < j; i += pix_size, j -= pix_size) { for (int32_t i = idx, j = idx + datalen - pix_size; i < j; i += pix_size, j -= pix_size) {
for (int32_t k = 0; k < pix_size; k++) { for (int32_t k = 0; k < pix_size; k++) {
@ -223,9 +223,9 @@ void ArtNetLoop(void)
packet_len = ArtNetUdp->parsePacket(); packet_len = ArtNetUdp->parsePacket();
packet_ready = (packet_len > 0); packet_ready = (packet_len > 0);
while (packet_ready) { while (packet_ready) {
uint8_t packet_buffer[UDP_BUFFER_SIZE]; // buffer to hold incoming UDP/SSDP packet uint8_t packet_buffer[WS2812_ARTNET_UDP_BUFFER_SIZE]; // buffer to hold incoming UDP/SSDP packet
packet_len = ArtNetUdp->read(packet_buffer, UDP_BUFFER_SIZE); packet_len = ArtNetUdp->read(packet_buffer, WS2812_ARTNET_UDP_BUFFER_SIZE);
ArtNetUdp->flush(); // Finish reading the current packet ArtNetUdp->flush(); // Finish reading the current packet
#endif #endif
// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: Packet %*_H (%d)"), 32, packet_buffer, packet_len); // AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: Packet %*_H (%d)"), 32, packet_buffer, packet_len);
@ -237,7 +237,7 @@ void ArtNetLoop(void)
packet_ready = ArtNetUdp->next(); packet_ready = ArtNetUdp->next();
if (!packet_ready) { if (!packet_ready) {
// if no more incoming packet, still wait for 20 microseconds // if no more incoming packet, still wait for 20 microseconds
delay(1); // delayMicroseconds seems broken, need to delay(1); // delayMicroseconds seems broken, need to
packet_ready = ArtNetUdp->next(); packet_ready = ArtNetUdp->next();
} }
#else #else
@ -291,13 +291,13 @@ void CmndArtNetConfig() {
ArtNetStop(); ArtNetStop();
} }
ArtNetLoadSettings(); ArtNetLoadSettings();
TrimSpace(XdrvMailbox.data); TrimSpace(XdrvMailbox.data);
if (strlen(XdrvMailbox.data) > 0) { if (strlen(XdrvMailbox.data) > 0) {
JsonParser parser(XdrvMailbox.data); JsonParser parser(XdrvMailbox.data);
JsonParserObject root = parser.getRootObject(); JsonParserObject root = parser.getRootObject();
if (!root) { ResponseCmndChar_P(PSTR(D_JSON_INVALID_JSON)); return; } if (!root) { ResponseCmndChar_P(PSTR(D_JSON_INVALID_JSON)); return; }
artnet_conf.rows = root.getUInt(PSTR("Rows"), artnet_conf.rows); artnet_conf.rows = root.getUInt(PSTR("Rows"), artnet_conf.rows);
artnet_conf.cols = root.getUInt(PSTR("Cols"), artnet_conf.cols); artnet_conf.cols = root.getUInt(PSTR("Cols"), artnet_conf.cols);
artnet_conf.offs = root.getUInt(PSTR("Offset"), artnet_conf.offs); artnet_conf.offs = root.getUInt(PSTR("Offset"), artnet_conf.offs);