Skip to content

Commit

Permalink
Fix for overallocated LiveView buffer.
Browse files Browse the repository at this point in the history
  • Loading branch information
blazoncek committed Feb 3, 2022
1 parent 795c515 commit 6180c2f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wled00/ws.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 6180c2f

Please sign in to comment.