From 827cdc2f5b57b9fa7c35dca404dace2d06317b3a Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 17 Apr 2024 19:57:14 +0100 Subject: [PATCH 1/6] AutoPlaylist - prevent swapping playlist after silence ended when Suspended --- usermods/usermod_v2_auto_playlist/usermod_v2_auto_playlist.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usermods/usermod_v2_auto_playlist/usermod_v2_auto_playlist.h b/usermods/usermod_v2_auto_playlist/usermod_v2_auto_playlist.h index 88d62654..adb5b37e 100644 --- a/usermods/usermod_v2_auto_playlist/usermod_v2_auto_playlist.h +++ b/usermods/usermod_v2_auto_playlist/usermod_v2_auto_playlist.h @@ -322,6 +322,8 @@ class AutoPlaylistUsermod : public Usermod { if (bri == 0) return; + if(!functionality_enabled) return; + um_data_t *um_data; if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) { From 6a93f46881ba7c25603f9bd5f1e200b3cb930608 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Sun, 26 May 2024 14:42:16 +0100 Subject: [PATCH 2/6] Disable serial console on default adafruit_matrixportal_esp32s3 builds so they boot without usb --- platformio.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 7c5b02a6..0e303f8d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -2490,7 +2490,8 @@ build_unflags = ${env:esp32S3_8MB_M.build_unflags} ;; use the same as "normal" build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation ${common_mm.build_flags_S} -D WLED_RELEASE_NAME=matrixportal_esp32s3 - -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1 ;; for Hardware-CDC USB mode + ; Serial debug enabled -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1 ;; for Hardware-CDC USB mode + -D ARDUINO_USB_CDC_ON_BOOT=0 -D WLED_DISABLE_ADALIGHT ;; disables serial protocols - recommended for Hardware-CDC USB (Serial RX will receive junk commands when RX pin is unconnected, unless its pulled down by resistor) ${common_mm.animartrix_build_flags} ${common_mm.build_disable_sync_interfaces} From 15199dc711616b8190219afafc07f5ae529dbe15 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Wed, 29 May 2024 15:43:24 +0200 Subject: [PATCH 3/6] protect unconnected USB-CDC from being used found a few more places where Serial was used without first checking if its connected. Arduino docs: `if (Serial)` indicates whether or not the USB CDC serial connection is open. For all non-USB CDC ports, this will always return true --- tools/ESP32-Chip_info.hpp | 2 ++ wled00/wled_serial.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tools/ESP32-Chip_info.hpp b/tools/ESP32-Chip_info.hpp index 89316598..417ee449 100644 --- a/tools/ESP32-Chip_info.hpp +++ b/tools/ESP32-Chip_info.hpp @@ -543,6 +543,8 @@ void show_psram_info_part2(void) void showRealSpeed() { //Serial.begin(115200); + if (!Serial) return; // Avoid writing to unconnected USB-CDC + Serial.flush(); Serial.println(F("\n")); for(int aa=0; aa<65; aa++) Serial.print("="); Serial.println(); diff --git a/wled00/wled_serial.cpp b/wled00/wled_serial.cpp index 221f21ad..9361891b 100644 --- a/wled00/wled_serial.cpp +++ b/wled00/wled_serial.cpp @@ -42,6 +42,7 @@ void updateBaudRate(uint32_t rate){ // RGB LED data return as JSON array. Slow, but easy to use on the other end. void sendJSON(){ if (!pinManager.isPinAllocated(hardwareTX) || pinManager.getPinOwner(hardwareTX) == PinOwner::DebugOut) { + if (!Serial) return; // WLEDMM avoid writing to unconnected USB-CDC uint16_t used = strip.getLengthTotal(); Serial.write('['); for (uint16_t i=0; i Date: Wed, 29 May 2024 15:51:44 +0200 Subject: [PATCH 4/6] another unprotected Serial real --- wled00/improv.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/wled00/improv.cpp b/wled00/improv.cpp index 646201d3..eef8ad82 100644 --- a/wled00/improv.cpp +++ b/wled00/improv.cpp @@ -50,6 +50,7 @@ void handleImprovPacket() { uint8_t rpcCommandType = 0; char rpcData[128]; rpcData[0] = 0; + if (!Serial) return; // WLEDMM avoid reading from unconnected USB-CDC while (!timeout) { if (Serial.available() < 1) { From d0941fd8767091aacb16649fd099d4b2846971ce Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Fri, 31 May 2024 15:50:10 +0200 Subject: [PATCH 5/6] Add UI error description. --- wled00/data/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wled00/data/index.js b/wled00/data/index.js index 4744fb38..7a9b5d57 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -1951,6 +1951,18 @@ function readState(s,command=false) if (s.error && s.error != 0) { var errstr = ""; switch (s.error) { + case 1: + errstr = "Denied!"; + break; + case 3: + errstr = "Buffer locked!"; + break; + case 8: + errstr = "Effect RAM depleted!"; + break; + case 9: + errstr = "JSON parsing error!"; + break; case 10: errstr = "Could not mount filesystem!"; break; From c532b5d31ae96dd2a99f2e583ca4a0346565d478 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Fri, 31 May 2024 18:18:58 +0200 Subject: [PATCH 6/6] Add UI error 14 description --- wled00/data/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wled00/data/index.js b/wled00/data/index.js index 7a9b5d57..1fcbfcaf 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -1975,6 +1975,9 @@ function readState(s,command=false) case 13: errstr = "Missing ir.json."; break; + case 14: + errstr = "Missing remote.json."; + break; case 19: errstr = "A filesystem error has occured."; break;