From 3ea5054cf2e1ad91175b0eafb7ac82e859bb5bc6 Mon Sep 17 00:00:00 2001 From: Keith Burzinski Date: Mon, 18 Dec 2023 17:11:07 -0600 Subject: [PATCH] Fix build issue with UART component when building with Arduino and CDC (#5964) --- esphome/components/uart/uart_component_esp32_arduino.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/esphome/components/uart/uart_component_esp32_arduino.cpp b/esphome/components/uart/uart_component_esp32_arduino.cpp index 75b67bf5c2..f77783e20e 100644 --- a/esphome/components/uart/uart_component_esp32_arduino.cpp +++ b/esphome/components/uart/uart_component_esp32_arduino.cpp @@ -88,7 +88,11 @@ void ESP32ArduinoUARTComponent::setup() { #endif static uint8_t next_uart_num = 0; if (is_default_tx && is_default_rx && next_uart_num == 0) { +#if ARDUINO_USB_CDC_ON_BOOT + this->hw_serial_ = &Serial0; +#else this->hw_serial_ = &Serial; +#endif next_uart_num++; } else { #ifdef USE_LOGGER