From 8ced4271412564bbc7918975896d61bc15642cd8 Mon Sep 17 00:00:00 2001 From: Marius Muja Date: Fri, 12 Jan 2024 23:28:13 -0800 Subject: [PATCH] Throttle 0x38 command insertion for 0x37 openers to 10s --- components/ratgdo/secplus1.cpp | 5 ++++- components/ratgdo/secplus1.h | 6 +----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/components/ratgdo/secplus1.cpp b/components/ratgdo/secplus1.cpp index 49e1c0a..c4a8c85 100644 --- a/components/ratgdo/secplus1.cpp +++ b/components/ratgdo/secplus1.cpp @@ -313,7 +313,10 @@ namespace secplus1 { this->is_0x37_panel_ = true; if (!this->do_transmit_if_pending()) { // inject door status request - this->transmit_byte(static_cast(CommandType::DOOR_STATUS), true); + if (millis() - this->last_status_query_ > 10000) { + this->transmit_byte(static_cast(CommandType::DOOR_STATUS), true); + this->last_status_query_ = millis(); + } } } else if (cmd.req == CommandType::OTHER_STATUS) { LightState light_state = to_LightState((cmd.resp >> 2) & 1, LightState::UNKNOWN); diff --git a/components/ratgdo/secplus1.h b/components/ratgdo/secplus1.h index 2902318..6e739f3 100644 --- a/components/ratgdo/secplus1.h +++ b/components/ratgdo/secplus1.h @@ -114,12 +114,8 @@ namespace secplus1 { bool is_0x37_panel_ { false }; std::priority_queue, FirstToSend> pending_tx_; - - // bool transmit_pending_ { false }; - // uint32_t transmit_pending_start_ { 0 }; - TxPacket tx_packet_; - uint32_t last_rx_ { 0 }; + uint32_t last_status_query_ { 0 }; SoftwareSerial sw_serial_;