From 84e38f765daa1e072a47991aa516b790e6c35437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Fri, 4 Feb 2022 07:59:17 +0100 Subject: [PATCH] Fix for incorrect buffer size when LED count = 256 --- wled00/ws.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/ws.cpp b/wled00/ws.cpp index 91111c16..711581f3 100644 --- a/wled00/ws.cpp +++ b/wled00/ws.cpp @@ -138,7 +138,7 @@ 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/MAX_LIVE_LEDS_WS) +1; //only serve every n'th LED if count over MAX_LIVE_LEDS_WS + uint16_t n = ((used-1)/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();