From 58c94f6d3b4ea85d006e51a3033234c53f7f3400 Mon Sep 17 00:00:00 2001 From: Marius Muja Date: Thu, 11 Jan 2024 11:28:37 -0800 Subject: [PATCH] Avoid long blocking in esphome loop --- components/ratgdo/secplus1.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/ratgdo/secplus1.cpp b/components/ratgdo/secplus1.cpp index 57ae2b2..4117145 100644 --- a/components/ratgdo/secplus1.cpp +++ b/components/ratgdo/secplus1.cpp @@ -273,18 +273,18 @@ namespace secplus1 { tx_delay += 250; } - // ESP_LOG2(TAG, "Sending byte in: %d", tx_delay); this->scheduler_->set_timeout(this->ratgdo_, "", tx_delay, [=] { this->sw_serial_.enableIntTx(false); this->sw_serial_.write(packet[0]); this->sw_serial_.enableIntTx(true); }); - - // ESP_LOG2(TAG, "Sending bytes in: %d", tx_delay+250); this->scheduler_->set_timeout(this->ratgdo_, "", tx_delay+250, [=] { this->sw_serial_.enableIntTx(false); this->sw_serial_.write(packet[1]); - delay(40); + this->sw_serial_.enableIntTx(true); + }); + this->scheduler_->set_timeout(this->ratgdo_, "", tx_delay+290, [=] { + this->sw_serial_.enableIntTx(false); this->sw_serial_.write(packet[1]); this->sw_serial_.enableIntTx(true); });