From e31eafe255377166fab454016c8feda26318b87d Mon Sep 17 00:00:00 2001 From: cjkas Date: Wed, 21 Oct 2026 19:51:46 +0200 Subject: [PATCH 1/2] fix: close WebSocket clients whose queue is full A client that stops reading (a frozen browser tab) keeps its TCP link alive, so neither AsyncTCP's ack timeout nor lwIP ever closes it. With setCloseClientOnQueueFull(false) every message dropped for it printed a warning, and each warning held up loop() for about 10ms on the UART. One such client stayed full for 44 minutes and made every step of loop() slow while shades moved. Closing it frees the queue. The web UI and Home Assistant reconnect and get the full state again from delayInit(). Co-Authored-By: Claude Opus 5.5 --- src/outputs/SocketEmitter.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/outputs/SocketEmitter.cpp b/src/outputs/SocketEmitter.cpp index f84a133..3c4b85f 100644 --- a/src/outputs/SocketEmitter.cpp +++ b/src/outputs/SocketEmitter.cpp @@ -210,7 +210,12 @@ void SocketEmitter::wsEvent(AsyncWebSocket *server, AsyncWebSocketClient *client slots[slot].connectedAt = millis(); slots[slot].lastPing = 0; client->text("Connected"); - client->setCloseClientOnQueueFull(false); + // A client that stops reading (a frozen browser tab) keeps its TCP link + // up, so nothing else ever closes it, and every message dropped for it + // logged a warning that held up loop() for ~10ms. Closing it frees the + // queue; the page and Home Assistant reconnect and get the full state + // again from delayInit(). + client->setCloseClientOnQueueFull(true); sockEmit.delayInit(slot); } break; From 304fa399d074eb56e7b03b53d5ce3d95a709cb30 Mon Sep 17 00:00:00 2001 From: cjkas Date: Wed, 21 Oct 2026 21:03:38 +0200 Subject: [PATCH 2/2] chore: make SomfyController a .cpp instead of an .ino PlatformIO converts an .ino into a fresh .cpp on every build, so the main file recompiled and the firmware relinked even when nothing had changed (about 25s of a no-change build of esp32dev). As a .cpp it only rebuilds when it changes. The release assets keep their SomfyController.ino.*.bin names, which the workflow sets itself. Co-Authored-By: Claude Opus 5.5 --- .gitignore | 3 --- src/{SomfyController.ino => SomfyController.cpp} | 0 2 files changed, 3 deletions(-) rename src/{SomfyController.ino => SomfyController.cpp} (100%) diff --git a/.gitignore b/.gitignore index ac78fb2..e05d7b9 100644 --- a/.gitignore +++ b/.gitignore @@ -27,9 +27,6 @@ elf_archive/ coredump_report.txt coredump.bin -# Project Specific / Generated Source -src/SomfyController.ino.cpp - # Ignore Somfy INO/Bin files SomfyController.ino.XIAO_ESP32S3.bin SomfyController.ino.esp32c3.bin diff --git a/src/SomfyController.ino b/src/SomfyController.cpp similarity index 100% rename from src/SomfyController.ino rename to src/SomfyController.cpp