mirror of
https://github.com/esphome/esphome.git
synced 2026-02-28 09:54:19 -07:00
[lightwaverf] Fix millis overflow in send timeout check (#14294)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -31,13 +31,12 @@ void LightWaveRF::read_tx() {
|
||||
void LightWaveRF::send_rx(const std::vector<uint8_t> &msg, uint8_t repeats, bool inverted, int u_sec) {
|
||||
this->lwtx_.lwtx_setup(pin_tx_, repeats, inverted, u_sec);
|
||||
|
||||
uint32_t timeout = 0;
|
||||
uint32_t timeout = millis();
|
||||
if (this->lwtx_.lwtx_free()) {
|
||||
this->lwtx_.lwtx_send(msg);
|
||||
timeout = millis();
|
||||
ESP_LOGD(TAG, "[%i] msg start", timeout);
|
||||
}
|
||||
while (!this->lwtx_.lwtx_free() && millis() < (timeout + 1000)) {
|
||||
while (!this->lwtx_.lwtx_free() && millis() - timeout < 1000) {
|
||||
delay(10);
|
||||
}
|
||||
timeout = millis() - timeout;
|
||||
|
||||
Reference in New Issue
Block a user