From aff4de34b449206e7d0f72c2b5719c8dc879b8f3 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Sun, 18 Jun 2023 01:07:50 +0200 Subject: [PATCH] WS logic: No resending, improved ESP8266 stability Update ESP8266 core to 3.1.2 --- CHANGELOG.md | 6 ++++++ wled00/const.h | 5 ++++- wled00/ws.cpp | 17 +++++++++-------- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11799d26..7866801e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,12 @@ - Improved ESP8266 stability by reducing WebSocket response resends - Updated ESP8266 core to 3.1.2 +#### Build 2306180 + +- Added client-side option for applying effect defaults from metadata +- Improved ESP8266 stability by reducing WebSocket response resends +- Updated ESP8266 core to 3.1.2 + #### Build 2306141 - Lissajous improvements - Scrolling Text improvements (leading 0) diff --git a/wled00/const.h b/wled00/const.h index 578e1ab0..fa3ded65 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -494,7 +494,10 @@ #define DEFAULT_LED_COUNT 30 #endif -#define INTERFACE_UPDATE_COOLDOWN 2000 //time in ms to wait between websockets, alexa, and MQTT updates +#define INTERFACE_UPDATE_COOLDOWN 1200 // time in ms to wait between websockets, alexa, and MQTT updates + +#define PIN_RETRY_COOLDOWN 3000 // time in ms after an incorrect attempt PIN and OTA pass will be rejected even if correct +#define PIN_TIMEOUT 900000 // time in ms after which the PIN will be required again, 15 minutes // HW_PIN_SCL & HW_PIN_SDA are used for information in usermods settings page and usermods themselves // which GPIO pins are actually used in a hardware layout (controller board) diff --git a/wled00/ws.cpp b/wled00/ws.cpp index 85f75406..be5e0687 100644 --- a/wled00/ws.cpp +++ b/wled00/ws.cpp @@ -62,14 +62,15 @@ void wsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventTyp } releaseJSONBufferLock(); // will clean fileDoc - // force broadcast in 500ms after updating client - if (verboseResponse) { - sendDataWs(client); - lastInterfaceUpdate = millis() - (INTERFACE_UPDATE_COOLDOWN -500); - } else { - // we have to send something back otherwise WS connection closes - client->text(F("{\"success\":true}")); - lastInterfaceUpdate = millis() - (INTERFACE_UPDATE_COOLDOWN -500); + if (!interfaceUpdateCallMode) { // individual client response only needed if no WS broadcast soon + if (verboseResponse) { + sendDataWs(client); + } else { + // we have to send something back otherwise WS connection closes + client->text(F("{\"success\":true}")); + } + // force broadcast in 500ms after updating client + //lastInterfaceUpdate = millis() - (INTERFACE_UPDATE_COOLDOWN -500); // ESP8266 does not like this } } } else {