Skip to content

Commit

Permalink
Reset the uart pin states as soon as possible after reset.
Browse files Browse the repository at this point in the history
  • Loading branch information
h2zero committed Jul 18, 2024
1 parent f8af4c7 commit d640605
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions components/secplus_gdo/secplus_gdo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions components/secplus_gdo/secplus_gdo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
6 changes: 5 additions & 1 deletion garage-door-GDOv2-Q.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d640605

Please sign in to comment.