1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-27 21:23:48 +00:00

Disallow using UART2 for logger on ESP-32 variants that lack it (#2510)

This commit is contained in:
Oxan van Leeuwen
2021-10-13 22:21:43 +02:00
committed by GitHub
parent 867fecd157
commit 6bbb5e9b56
3 changed files with 15 additions and 6 deletions

View File

@@ -153,13 +153,9 @@ void Logger::pre_setup() {
case UART_SELECTION_UART1:
this->hw_serial_ = &Serial1;
break;
#ifdef USE_ESP32
#if defined(USE_ESP32) && !CONFIG_IDF_TARGET_ESP32C3 && !CONFIG_IDF_TARGET_ESP32S2
case UART_SELECTION_UART2:
#if !CONFIG_IDF_TARGET_ESP32S2 && !CONFIG_IDF_TARGET_ESP32C3
// FIXME: Validate in config that UART2 can't be set for ESP32-S2 (only has
// UART0-UART1)
this->hw_serial_ = &Serial2;
#endif
break;
#endif
}
@@ -173,9 +169,11 @@ void Logger::pre_setup() {
case UART_SELECTION_UART1:
uart_num_ = UART_NUM_1;
break;
#if !CONFIG_IDF_TARGET_ESP32C3 && !CONFIG_IDF_TARGET_ESP32S2
case UART_SELECTION_UART2:
uart_num_ = UART_NUM_2;
break;
#endif
}
uart_config_t uart_config{};
uart_config.baud_rate = (int) baud_rate_;