From 117cee9e6e2e1772466273aa536d220f940a1509 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:58:30 +0200 Subject: [PATCH] Update esp32 platform to 2024.04.14 (#21299) * use new HWCDC Arduino code --- platformio_tasmota32.ini | 2 +- tasmota/tasmota.ino | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/platformio_tasmota32.ini b/platformio_tasmota32.ini index 89ef0239e..89740de26 100644 --- a/platformio_tasmota32.ini +++ b/platformio_tasmota32.ini @@ -77,7 +77,7 @@ lib_ignore = ${esp32_defaults.lib_ignore} ccronexpr [core32] -platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.04.12/platform-espressif32.zip +platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.04.14/platform-espressif32.zip platform_packages = build_unflags = ${esp32_defaults.build_unflags} build_flags = ${esp32_defaults.build_flags} diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index b3a70d13e..58ce6d068 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -474,8 +474,10 @@ void setup(void) { bool is_connected_to_USB = false; #if SOC_USB_SERIAL_JTAG_SUPPORTED // Not S2 + TasConsole.setRxBufferSize(INPUT_BUFFER_SIZE); + TasConsole.begin(115200); // always start CDC to test plugged cable for (uint32_t i = 0; i < 5; i++) { // wait up to 250 ms - maybe a shorter time is enough - is_connected_to_USB = usb_serial_jtag_is_connected(); + is_connected_to_USB = HWCDCSerial.isPlugged(); if (is_connected_to_USB) { break; } delay(50); } @@ -484,19 +486,20 @@ void setup(void) { #endif // SOC_USB_SERIAL_JTAG_SUPPORTED if (is_connected_to_USB) { - TasConsole.setRxBufferSize(INPUT_BUFFER_SIZE); -// TasConsole.setTxBufferSize(INPUT_BUFFER_SIZE); - TasConsole.begin(115200); // Will always be 115200 bps + // TasConsole is already running #if !ARDUINO_USB_MODE USB.begin(); // This needs a serial console with DTR/DSR support #endif // No ARDUINO_USB_MODE TasConsole.println(); AddLog(LOG_LEVEL_INFO, PSTR("CMD: Using USB CDC")); } else { + #if SOC_USB_SERIAL_JTAG_SUPPORTED // Not S2 + HWCDCSerial.~HWCDC(); // not needed, deinit CDC + #endif // SOC_USB_SERIAL_JTAG_SUPPORTED // Init command serial console preparing for AddLog use Serial.begin(TasmotaGlobal.baudrate); Serial.println(); - TasConsole = Serial; // Fallback + TasConsole = Serial; // Fallback tasconsole_serial = true; AddLog(LOG_LEVEL_INFO, PSTR("CMD: Fall back to serial port, no SOF packet detected on USB port")); }