From 81aa48a5f346f8127b6a50563e045ebd9af90eb3 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Wed, 13 Dec 2023 23:45:08 +0100 Subject: [PATCH] Exposes `load_settings` to `UARTComponent` class (#5920) --- esphome/components/uart/uart_component.h | 4 ++++ esphome/components/uart/uart_component_esp32_arduino.h | 3 ++- esphome/components/uart/uart_component_esp_idf.h | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/esphome/components/uart/uart_component.h b/esphome/components/uart/uart_component.h index 42702cf5b8..34bda42bb5 100644 --- a/esphome/components/uart/uart_component.h +++ b/esphome/components/uart/uart_component.h @@ -62,6 +62,10 @@ class UARTComponent { UARTParityOptions get_parity() const { return this->parity_; } void set_baud_rate(uint32_t baud_rate) { baud_rate_ = baud_rate; } uint32_t get_baud_rate() const { return baud_rate_; } +#ifdef USE_ESP32 + virtual void load_settings() = 0; + virtual void load_settings(bool dump_config) = 0; +#endif // USE_ESP32 #ifdef USE_UART_DEBUGGER void add_debug_callback(std::function &&callback) { diff --git a/esphome/components/uart/uart_component_esp32_arduino.h b/esphome/components/uart/uart_component_esp32_arduino.h index ec4953a598..de17d9718b 100644 --- a/esphome/components/uart/uart_component_esp32_arduino.h +++ b/esphome/components/uart/uart_component_esp32_arduino.h @@ -44,7 +44,8 @@ class ESP32ArduinoUARTComponent : public UARTComponent, public Component { * * This will load the current UART interface with the latest settings (baud_rate, parity, etc). */ - void load_settings(bool dump_config = true); + void load_settings(bool dump_config) override; + void load_settings() override { this->load_settings(true); } protected: void check_logger_conflict() override; diff --git a/esphome/components/uart/uart_component_esp_idf.h b/esphome/components/uart/uart_component_esp_idf.h index 068ebd32dc..215641ebe2 100644 --- a/esphome/components/uart/uart_component_esp_idf.h +++ b/esphome/components/uart/uart_component_esp_idf.h @@ -38,7 +38,8 @@ class IDFUARTComponent : public UARTComponent, public Component { * * This will load the current UART interface with the latest settings (baud_rate, parity, etc). */ - void load_settings(bool dump_config = true); + void load_settings(bool dump_config) override; + void load_settings() override { this->load_settings(true); } protected: void check_logger_conflict() override;