diff --git a/components/ratgdo/ratgdo.cpp b/components/ratgdo/ratgdo.cpp index 3ed1913..9c1d0f2 100644 --- a/components/ratgdo/ratgdo.cpp +++ b/components/ratgdo/ratgdo.cpp @@ -13,6 +13,8 @@ #include "ratgdo.h" #include "esphome/core/log.h" +#include "esphome/components/uart/uart.h" +#include "esphome/core/component.h" namespace esphome { namespace ratgdo { @@ -90,14 +92,10 @@ namespace ratgdo { } } - class RATGDOComponent : public Component, public UARTDevice { + class RATGDOComponent : public uart::UARTDevice, public Component { public: - RATGDOComponent(UARTComponent* parent) - : UARTDevice(parent) - { - } - void setup() + void setup() override { this->pref_ = global_preferences->make_preference(734874333U); if (!this->pref_.load(&this->rollingCodeCounter)) { @@ -144,7 +142,7 @@ namespace ratgdo { // reboot/sync to the opener on startup } - void loop() + void loop() override { ESP_LOGD(TAG, "loop rollingCodeCounter: %d", this->rollingCodeCounter); obstructionLoop(); diff --git a/components/ratgdo/ratgdo.h b/components/ratgdo/ratgdo.h index 151d2b3..f56193f 100644 --- a/components/ratgdo/ratgdo.h +++ b/components/ratgdo/ratgdo.h @@ -12,11 +12,12 @@ ************************************/ #pragma once -#include "esphome/components/uart/uart.h" #include "esphome/core/component.h" #include "esphome/core/gpio.h" -#include "esphome/core/log.h" #include "esphome/core/preferences.h" +#include "esphome/core/log.h" +#include "esphome/components/uart/uart.h" +#include "esphome/core/component.h" #include "SoftwareSerial.h" extern "C" { @@ -28,6 +29,7 @@ extern "C" { namespace esphome { namespace ratgdo { + struct RATGDOStore { ISRInternalGPIOPin input_obst;