From d640605817c1ec5b2520b297bf4ca6f6c6ac22eb Mon Sep 17 00:00:00 2001 From: Ryan Powell Date: Thu, 18 Jul 2024 11:49:41 -0600 Subject: [PATCH] Reset the uart pin states as soon as possible after reset. --- components/secplus_gdo/secplus_gdo.cpp | 5 +++++ components/secplus_gdo/secplus_gdo.h | 1 + garage-door-GDOv2-Q.yaml | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/components/secplus_gdo/secplus_gdo.cpp b/components/secplus_gdo/secplus_gdo.cpp index a11ad93..e8c3b42 100644 --- a/components/secplus_gdo/secplus_gdo.cpp +++ b/components/secplus_gdo/secplus_gdo.cpp @@ -170,5 +170,10 @@ namespace secplus_gdo { } } + void GDOComponent::zero_state() { + gpio_reset_pin((gpio_num_t)GDO_UART_TX_PIN); + gpio_reset_pin((gpio_num_t)GDO_UART_RX_PIN); + } + } // namespace secplus_gdo } // namespace esphome \ No newline at end of file diff --git a/components/secplus_gdo/secplus_gdo.h b/components/secplus_gdo/secplus_gdo.h index e976b05..74355d9 100644 --- a/components/secplus_gdo/secplus_gdo.h +++ b/components/secplus_gdo/secplus_gdo.h @@ -36,6 +36,7 @@ namespace secplus_gdo { void dump_config() override; void on_shutdown() override { gdo_deinit(); } void start_gdo() { start_gdo_ = true; } + void zero_state(); // Use Late priority so we do not start the GDO lib until all saved preferences are loaded float get_setup_priority() const override { return setup_priority::LATE; } diff --git a/garage-door-GDOv2-Q.yaml b/garage-door-GDOv2-Q.yaml index e6ff1f7..10c471f 100644 --- a/garage-door-GDOv2-Q.yaml +++ b/garage-door-GDOv2-Q.yaml @@ -89,7 +89,7 @@ substitutions: status_led: GPIO18 external_components: - - source: github://konnected-io/konnected-esphome@master + - source: github://konnected-io/konnected-esphome@zero-state components: [ mdns, secplus_gdo ] # Un-comment below and comment above for local modification @@ -184,6 +184,10 @@ api: web_server: esphome: + on_boot: + priority: 1001 + then: + - lambda: id(gdo_blaq).zero_state(); platformio_options: lib_deps: - https://github.com/konnected-io/gdolib#76ba232