From cded92662f390e4281e4f1d58cfe35cede90f64b Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Thu, 16 Mar 2023 13:08:34 +0100 Subject: [PATCH] workaround for issue #3128 --- wled00/wled.cpp | 3 +++ wled00/wled.h | 2 +- wled00/wled_serial.cpp | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wled00/wled.cpp b/wled00/wled.cpp index dcb944836..f46483beb 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -267,6 +267,9 @@ void WLED::setup() WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detection #endif + #ifdef ARDUINO_ARCH_ESP32 + pinMode(hardwareRX, INPUT_PULLDOWN); delay(1); // suppress noise in case RX pin is floating (at low noise energy) - see issue #3128 + #endif Serial.begin(115200); #if !ARDUINO_USB_CDC_ON_BOOT Serial.setTimeout(50); // this causes troubles on new MCUs that have a "virtual" USB Serial (HWCDC) diff --git a/wled00/wled.h b/wled00/wled.h index ffb547eae..b51a85402 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2303050 +#define VERSION 2303160 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG diff --git a/wled00/wled_serial.cpp b/wled00/wled_serial.cpp index 3e416b951..4d920e340 100644 --- a/wled00/wled_serial.cpp +++ b/wled00/wled_serial.cpp @@ -70,6 +70,7 @@ void sendBytes(){ void handleSerial() { if (pinManager.isPinAllocated(hardwareRX)) return; + if (!Serial) return; // 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 #ifdef WLED_ENABLE_ADALIGHT static auto state = AdaState::Header_A;