Workaround HWCDC exception

This commit is contained in:
Theo Arends 2022-04-25 12:03:53 +02:00
parent 6466da6d8b
commit 2add4d4712
1 changed files with 7 additions and 4 deletions

View File

@ -1898,14 +1898,17 @@ void SetSerialBegin(void) {
SetSerialSwap(); SetSerialSwap();
#endif // ESP8266 #endif // ESP8266
#ifdef ESP32 #ifdef ESP32
#ifdef ARDUINO_USB_CDC_ON_BOOT
// Serial.end();
// Serial.begin();
// Above sequence ends in "Exception":5,"Reason":"Load access fault"
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_SERIAL "HWCDC supports 115200 bit/s only"));
#else
delay(10); // Allow time to cleanup queues - if not used hangs ESP32 delay(10); // Allow time to cleanup queues - if not used hangs ESP32
Serial.end(); Serial.end();
delay(10); // Allow time to cleanup queues - if not used hangs ESP32 delay(10); // Allow time to cleanup queues - if not used hangs ESP32
#ifdef ARDUINO_USB_CDC_ON_BOOT
Serial.begin(TasmotaGlobal.baudrate);
#else
Serial.begin(TasmotaGlobal.baudrate, ConvertSerialConfig(Settings->serial_config)); Serial.begin(TasmotaGlobal.baudrate, ConvertSerialConfig(Settings->serial_config));
#endif // ARDUINO_USB_CDC_ON_BOOT #endif // Not ARDUINO_USB_CDC_ON_BOOT
#endif // ESP32 #endif // ESP32
} }