Remove unused abstractions

There's only 1 protocol (secplus2) and board (esp32)
This commit is contained in:
2026-05-28 16:06:18 +00:00
parent 216e66819b
commit ecd6a42aee
6 changed files with 10 additions and 54 deletions
-38
View File
@@ -1,38 +0,0 @@
#pragma once
#include "common.h"
#include "ratgdo_state.h"
namespace esphome {
class Scheduler;
class InternalGPIOPin;
} // namespace esphome
namespace esphome::ratgdo {
class RATGDOComponent;
namespace protocol {
class Protocol {
public:
virtual void setup(RATGDOComponent* ratgdo, Scheduler* scheduler, InternalGPIOPin* rx_pin, InternalGPIOPin* tx_pin);
virtual void loop();
virtual void dump_config();
virtual void on_shutdown() { }
virtual void sync();
virtual void light_action(LightAction action);
virtual void lock_action(LockAction action);
virtual void door_action(DoorAction action);
virtual void query_status() {}
virtual void query_openings() {}
};
}
} // namespace esphome::ratgdo
+1 -1
View File
@@ -23,7 +23,7 @@
namespace esphome::ratgdo { namespace esphome::ratgdo {
using namespace protocol;
static const char* const TAG = "ratgdo"; static const char* const TAG = "ratgdo";
static constexpr int SYNC_DELAY = 5000; static constexpr int SYNC_DELAY = 5000;
+3 -2
View File
@@ -24,11 +24,12 @@
#include "callbacks.h" #include "callbacks.h"
#include "observable.h" #include "observable.h"
#include "protocol.h"
#include "ratgdo_state.h" #include "ratgdo_state.h"
namespace esphome::ratgdo { namespace esphome::ratgdo {
namespace secplus2 { class Secplus2; }
class RATGDOComponent; class RATGDOComponent;
typedef Parented<RATGDOComponent> RATGDOClient; typedef Parented<RATGDOComponent> RATGDOClient;
@@ -185,7 +186,7 @@ public:
protected: protected:
// Pointers first (4-byte aligned) // Pointers first (4-byte aligned)
protocol::Protocol* protocol_; secplus2::Secplus2* protocol_;
InternalGPIOPin* output_gdo_pin_; InternalGPIOPin* output_gdo_pin_;
InternalGPIOPin* input_gdo_pin_; InternalGPIOPin* input_gdo_pin_;
-4
View File
@@ -1,4 +0,0 @@
#pragma once
#include "esphome/core/defines.h"
#include "ratgdo_uart_esp32.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "ratgdo_uart.h" #include "ratgdo_uart_esp32.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include <driver/uart.h> #include <driver/uart.h>
+5 -8
View File
@@ -3,12 +3,11 @@
#include "esphome/core/optional.h" #include "esphome/core/optional.h"
#include "esphome/core/preferences.h" #include "esphome/core/preferences.h"
#include "esphome/components/mqtt/mqtt_client.h" #include "esphome/components/mqtt/mqtt_client.h"
#include "ratgdo_uart.h" #include "ratgdo_uart_esp32.h"
#include "callbacks.h" #include "callbacks.h"
#include "common.h" #include "common.h"
#include "observable.h" #include "observable.h"
#include "protocol.h"
#include "ratgdo_state.h" #include "ratgdo_state.h"
namespace esphome { namespace esphome {
@@ -23,8 +22,6 @@ class RATGDOComponent;
namespace secplus2 { namespace secplus2 {
using namespace esphome::ratgdo::protocol;
static const uint8_t PACKET_LENGTH = 19; static const uint8_t PACKET_LENGTH = 19;
typedef uint8_t WirePacket[PACKET_LENGTH]; typedef uint8_t WirePacket[PACKET_LENGTH];
@@ -94,12 +91,12 @@ namespace secplus2 {
} }
}; };
class Secplus2 : public Protocol { class Secplus2 {
public: public:
void setup(RATGDOComponent* ratgdo, Scheduler* scheduler, InternalGPIOPin* rx_pin, InternalGPIOPin* tx_pin); void setup(RATGDOComponent* ratgdo, Scheduler* scheduler, InternalGPIOPin* rx_pin, InternalGPIOPin* tx_pin);
void loop(); void loop();
void dump_config(); void dump_config();
void on_shutdown() override; void on_shutdown();
void sync(); void sync();
@@ -107,8 +104,8 @@ namespace secplus2 {
void lock_action(LockAction action); void lock_action(LockAction action);
void door_action(DoorAction action); void door_action(DoorAction action);
void query_status() override; void query_status();
void query_openings() override; void query_openings();
protected: protected:
void increment_rolling_code_counter(int delta = 1); void increment_rolling_code_counter(int delta = 1);