mirror of
https://github.com/wled/WLED.git
synced 2025-07-08 11:26:33 +00:00
serveLiveLeds: Use variable buffer size
Allocate the serialization buffer size at the required length, rather than always allocating the maximum size.
This commit is contained in:
parent
2640203c88
commit
8b6bf08a23
@ -1152,7 +1152,7 @@ bool serveLiveLeds(AsyncWebServerRequest* request, uint32_t wsClient)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DynamicBuffer buffer(9 + (9*MAX_LIVE_LEDS) + 7 + 5 + 6 + 5 + 6 + 5 + 2);
|
DynamicBuffer buffer(9 + (9*(1+(used/n))) + 7 + 5 + 6 + 5 + 6 + 5 + 2);
|
||||||
char* buf = buffer.data(); // assign buffer for oappnd() functions
|
char* buf = buffer.data(); // assign buffer for oappnd() functions
|
||||||
strncpy_P(buffer.data(), PSTR("{\"leds\":["), buffer.size());
|
strncpy_P(buffer.data(), PSTR("{\"leds\":["), buffer.size());
|
||||||
buf += 9; // sizeof(PSTR()) from last line
|
buf += 9; // sizeof(PSTR()) from last line
|
||||||
|
Loading…
x
Reference in New Issue
Block a user