From 0ca3f136b12b560d95be671cad57720c9fbf4641 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sat, 28 Sep 2024 02:06:48 +0200 Subject: [PATCH] ws error printing improvement * limit to 3 messages per second * print size when alloc failed --- wled00/ws.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wled00/ws.cpp b/wled00/ws.cpp index 22c5afd2..85bad64d 100644 --- a/wled00/ws.cpp +++ b/wled00/ws.cpp @@ -215,7 +215,11 @@ static bool sendLiveLedsWs(uint32_t wsClient) // WLEDMM added "static" if ((bufSize < 1) || (used < 1)) return(false); // WLEDMM should not happen AsyncWebSocketBuffer wsBuf(bufSize); if (!wsBuf) { - USER_PRINTLN(F("WS buffer allocation failed.")); + static unsigned long last_err_time = 0; + if (millis() - last_err_time > 300) { // WLEDMM limit to 3 messages per second + USER_PRINTF("WS buffer allocation failed (!wsBuf %u bytes).\n", bufSize); + last_err_time = millis(); + } errorFlag = ERR_LOW_WS_MEM; return false; //out of memory }