Skip to content

Commit d40f66e

Browse files
authored
fixes C6|H2 issue
issue with `if(Serial)` not working always
1 parent d9e5a6f commit d40f66e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cores/esp32/HWCDC.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,12 @@ void HWCDC::begin(unsigned long baud)
242242
log_e("HW CDC TX Buffer error");
243243
}
244244
}
245+
246+
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2
247+
// it needs the HW Serial pins to be first deinited in order to allow `if(Serial)` to work :-(
248+
deinit(NULL);
249+
delay(10);
250+
#endif
245251
// Setting USB D+ D- pins || reduces number of debug messages
246252
uint8_t pin = USB_DM_GPIO_NUM;
247253
if(perimanGetPinBusType(pin) != ESP32_BUS_TYPE_USB_DM){

0 commit comments

Comments
 (0)