Update esp32 platform to 2024.04.14 (#21299)

* use new HWCDC Arduino code
This commit is contained in:
Jason2866 2024-04-30 17:58:30 +02:00 committed by GitHub
parent fd148a8d12
commit 117cee9e6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View File

@ -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}

View File

@ -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"));
}