Merge branch 'dev' into sync-seg
This commit is contained in:
commit
47a620bd36
@ -302,9 +302,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef WLED_USE_DYNAMIC_JSON
|
||||
#define MIN_HEAP_SIZE JSON_BUFFER_SIZE+512
|
||||
#define MIN_HEAP_SIZE (JSON_BUFFER_SIZE+512)
|
||||
#else
|
||||
#define MIN_HEAP_SIZE 4096
|
||||
#define MIN_HEAP_SIZE (MAX_LED_MEMORY+2048)
|
||||
#endif
|
||||
|
||||
// Maximum size of node map (list of other WLED instances)
|
||||
|
@ -117,8 +117,10 @@ void sendDataWs(AsyncWebSocketClient * client)
|
||||
serializeInfo(info);
|
||||
DEBUG_PRINTF("JSON buffer size: %u for WS request.\n", doc.memoryUsage());
|
||||
size_t len = measureJson(doc);
|
||||
buffer = ws.makeBuffer(len);
|
||||
if (!buffer) {
|
||||
size_t heap1 = ESP.getFreeHeap();
|
||||
buffer = ws.makeBuffer(len); // will not allocate correct memory sometimes
|
||||
size_t heap2 = ESP.getFreeHeap();
|
||||
if (!buffer || heap1-heap2<len) {
|
||||
releaseJSONBufferLock();
|
||||
return; //out of memory
|
||||
}
|
||||
@ -139,10 +141,13 @@ void handleWs()
|
||||
{
|
||||
if (millis() - wsLastLiveTime > WS_LIVE_INTERVAL)
|
||||
{
|
||||
#ifdef ESP8266
|
||||
ws.cleanupClients(2);
|
||||
#else
|
||||
ws.cleanupClients();
|
||||
#endif
|
||||
bool success = true;
|
||||
if (wsLiveClientId)
|
||||
success = serveLiveLeds(nullptr, wsLiveClientId);
|
||||
if (wsLiveClientId) success = serveLiveLeds(nullptr, wsLiveClientId);
|
||||
wsLastLiveTime = millis();
|
||||
if (!success) wsLastLiveTime -= 20; //try again in 20ms if failed due to non-empty WS queue
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user