From 575311f0e8cdb2bbfd1f68d08ff5edb4b0d4d090 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 16 Aug 2026 20:27:20 -0500 Subject: [PATCH] [uart] Re-arm the dropped write warning and unify the readiness predicate Reset the one-shot warning when the driver is reinstalled so a later not-installed episode is loud again, and use the driver installed flag in the rx threshold and timeout setters so the file carries a single readiness predicate. --- esphome/components/uart/uart_component_esp_idf.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/esphome/components/uart/uart_component_esp_idf.cpp b/esphome/components/uart/uart_component_esp_idf.cpp index 78e28d78d3..8a3aa98321 100644 --- a/esphome/components/uart/uart_component_esp_idf.cpp +++ b/esphome/components/uart/uart_component_esp_idf.cpp @@ -148,6 +148,9 @@ void IDFUARTComponent::load_settings(bool dump_config) { return; } this->driver_installed_ = true; + // Re-arm the dropped-write warning so a later not-installed episode + // (a failed reinstall through load_settings) is loud again + this->warned_not_ready_ = false; // uart_param_config must be called after uart_driver_install and before any // other uart_set_*() calls. The driver installation resets the UART peripheral @@ -281,7 +284,7 @@ void IDFUARTComponent::dump_config() { } void IDFUARTComponent::set_rx_full_threshold(size_t rx_full_threshold) { - if (this->is_ready()) { + if (this->driver_installed_) { esp_err_t err = uart_set_rx_full_threshold(this->uart_num_, rx_full_threshold); if (err != ESP_OK) { ESP_LOGW(TAG, "uart_set_rx_full_threshold failed: %s", esp_err_to_name(err)); @@ -292,7 +295,7 @@ void IDFUARTComponent::set_rx_full_threshold(size_t rx_full_threshold) { } void IDFUARTComponent::set_rx_timeout(size_t rx_timeout) { - if (this->is_ready()) { + if (this->driver_installed_) { esp_err_t err = uart_set_rx_timeout(this->uart_num_, rx_timeout); if (err != ESP_OK) { ESP_LOGW(TAG, "uart_set_rx_timeout failed: %s", esp_err_to_name(err));