From 61b8e9554325e589a43242ee23ec8e8d8b811e07 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 26 Mar 2023 16:37:29 +0200 Subject: [PATCH] Fix ESP32 change baudrate (#17869) --- lib/default/TasmotaSerial-3.6.0/src/TasmotaSerial.cpp | 4 ++-- tasmota/tasmota_support/support.ino | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/default/TasmotaSerial-3.6.0/src/TasmotaSerial.cpp b/lib/default/TasmotaSerial-3.6.0/src/TasmotaSerial.cpp index e54692ab5..18cfee1e0 100644 --- a/lib/default/TasmotaSerial-3.6.0/src/TasmotaSerial.cpp +++ b/lib/default/TasmotaSerial-3.6.0/src/TasmotaSerial.cpp @@ -228,7 +228,7 @@ bool TasmotaSerial::begin(uint32_t speed, uint32_t config) { #ifdef ESP32 if (TSerial == nullptr) { // Allow for dynamic change in baudrate or config if (freeUart()) { // We prefer UART1 and UART2 and keep UART0 for debugging -#ifdef ARDUINO_USB_CDC_ON_BOOT +#if ARDUINO_USB_MODE TSerial = new HardwareSerial(m_uart); #else if (0 == m_uart) { @@ -239,7 +239,7 @@ bool TasmotaSerial::begin(uint32_t speed, uint32_t config) { } else { TSerial = new HardwareSerial(m_uart); } -#endif // ARDUINO_USB_CDC_ON_BOOT +#endif // ARDUINO_USB_MODE if (serial_buffer_size > 256) { // RX Buffer can't be resized when Serial is already running (HardwareSerial.cpp) TSerial->setRxBufferSize(serial_buffer_size); } diff --git a/tasmota/tasmota_support/support.ino b/tasmota/tasmota_support/support.ino index 1452a7fab..00ed4c2e0 100755 --- a/tasmota/tasmota_support/support.ino +++ b/tasmota/tasmota_support/support.ino @@ -2018,7 +2018,7 @@ void SetSerialBegin(void) { SetSerialSwap(); #endif // ESP8266 #ifdef ESP32 -#ifdef ARDUINO_USB_CDC_ON_BOOT +#if ARDUINO_USB_MODE // Serial.end(); // Serial.begin(); // Above sequence ends in "Exception":5,"Reason":"Load access fault" @@ -2028,7 +2028,7 @@ void SetSerialBegin(void) { Serial.end(); delay(10); // Allow time to cleanup queues - if not used hangs ESP32 Serial.begin(TasmotaGlobal.baudrate, ConvertSerialConfig(Settings->serial_config)); -#endif // Not ARDUINO_USB_CDC_ON_BOOT +#endif // Not ARDUINO_USB_MODE #endif // ESP32 }