From c04c73bbd7f448312c368e33773e510d4e8324cf 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 ++++++ platformio.ini | 3 ++- wled00/const.h | 2 +- wled00/wled.h | 2 +- wled00/ws.cpp | 17 +++++++++-------- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a12d25e7..e2900d9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## WLED changelog +#### 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/platformio.ini b/platformio.ini index ae0e4abd..8838b9a7 100644 --- a/platformio.ini +++ b/platformio.ini @@ -60,13 +60,14 @@ arduino_core_2_7_4 = espressif8266@2.6.2 arduino_core_3_0_0 = espressif8266@3.0.0 arduino_core_3_2_0 = espressif8266@3.2.0 arduino_core_4_1_0 = espressif8266@4.1.0 +arduino_core_3_1_2 = espressif8266@4.2.0 # Development platforms arduino_core_develop = https://github.com/platformio/platform-espressif8266#develop arduino_core_git = https://github.com/platformio/platform-espressif8266#feature/stage # Platform to use for ESP8266 -platform_wled_default = ${common.arduino_core_4_1_0} +platform_wled_default = ${common.arduino_core_3_1_2} # We use 2.7.4.7 for all, includes PWM flicker fix and Wstring optimization #platform_packages = tasmota/framework-arduinoespressif8266 @ 3.20704.7 platform_packages = platformio/framework-arduinoespressif8266 diff --git a/wled00/const.h b/wled00/const.h index 3dc4e6cd..14369e22 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -460,7 +460,7 @@ #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 1000 // 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 diff --git a/wled00/wled.h b/wled00/wled.h index d4539469..01d26caf 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2306150 +#define VERSION 2306180 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG diff --git a/wled00/ws.cpp b/wled00/ws.cpp index b221586b..2a4d0b96 100644 --- a/wled00/ws.cpp +++ b/wled00/ws.cpp @@ -54,14 +54,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 {