From 0c07766cab304e83345d0c0445959d1dfc360b64 Mon Sep 17 00:00:00 2001 From: mulcmu Date: Fri, 18 Aug 2023 20:37:51 -0400 Subject: [PATCH] Fix obstruction isr for ESP32 (#38) Fix obsruction isr for ESP32 In RATGDOComponent::setup() call the ESPHome code to attach_interrupt() before software serial begin(). This allows ESPHome to call IDF gpio_install_isr_service() without error. --- components/ratgdo/ratgdo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/ratgdo/ratgdo.cpp b/components/ratgdo/ratgdo.cpp index f44ba6c..723de93 100644 --- a/components/ratgdo/ratgdo.cpp +++ b/components/ratgdo/ratgdo.cpp @@ -53,11 +53,11 @@ namespace ratgdo { this->output_gdo_pin_->pin_mode(gpio::FLAG_OUTPUT); this->input_gdo_pin_->pin_mode(gpio::FLAG_INPUT | gpio::FLAG_PULLUP); this->input_obst_pin_->pin_mode(gpio::FLAG_INPUT); + + this->input_obst_pin_->attach_interrupt(RATGDOStore::isr_obstruction, &this->isr_store_, gpio::INTERRUPT_ANY_EDGE); this->sw_serial_.begin(9600, SWSERIAL_8N1, this->input_gdo_pin_->get_pin(), this->output_gdo_pin_->get_pin(), true); - this->input_obst_pin_->attach_interrupt(RATGDOStore::isr_obstruction, &this->isr_store_, gpio::INTERRUPT_ANY_EDGE); - ESP_LOGV(TAG, "Syncing rolling code counter after reboot..."); // many things happening at startup, use some delay for sync