Avoid long blocking in esphome loop

This commit is contained in:
Marius Muja 2024-01-11 11:28:37 -08:00
parent fe582a642d
commit 58c94f6d3b
1 changed files with 4 additions and 4 deletions

View File

@ -273,18 +273,18 @@ namespace secplus1 {
tx_delay += 250; tx_delay += 250;
} }
// ESP_LOG2(TAG, "Sending byte in: %d", tx_delay);
this->scheduler_->set_timeout(this->ratgdo_, "", tx_delay, [=] { this->scheduler_->set_timeout(this->ratgdo_, "", tx_delay, [=] {
this->sw_serial_.enableIntTx(false); this->sw_serial_.enableIntTx(false);
this->sw_serial_.write(packet[0]); this->sw_serial_.write(packet[0]);
this->sw_serial_.enableIntTx(true); 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->scheduler_->set_timeout(this->ratgdo_, "", tx_delay+250, [=] {
this->sw_serial_.enableIntTx(false); this->sw_serial_.enableIntTx(false);
this->sw_serial_.write(packet[1]); 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_.write(packet[1]);
this->sw_serial_.enableIntTx(true); this->sw_serial_.enableIntTx(true);
}); });