diff --git a/tools/ESP32-Chip_info.hpp b/tools/ESP32-Chip_info.hpp index 893165985a..417ee44915 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 221f21ad85..9361891b5a 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