Fix for overallocated LiveView buffer.

pull/2414/head^2
Blaz Kristan 2022-02-03 20:21:09 +01:00
rodzic 795c515999
commit 6180c2f948
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -131,8 +131,8 @@ bool sendLiveLedsWs(uint32_t wsClient)
if (!wsc || wsc->queueLength() > 0) return false; //only send if queue free
uint16_t used = strip.getLengthTotal();
uint16_t n = (used -1) /MAX_LIVE_LEDS_WS +1; //only serve every n'th LED if count over MAX_LIVE_LEDS
AsyncWebSocketMessageBuffer * wsBuf = ws.makeBuffer(2 + MIN(used, MAX_LIVE_LEDS_WS)*3);
uint16_t n = (used/MAX_LIVE_LEDS_WS) +1; //only serve every n'th LED if count over MAX_LIVE_LEDS_WS
AsyncWebSocketMessageBuffer * wsBuf = ws.makeBuffer(2 + (used*3)/n);
if (!wsBuf) return false; //out of memory
uint8_t* buffer = wsBuf->get();
buffer[0] = 'L';