From a60e5c5c4f5b3871ac30633ed007f21bbbc24333 Mon Sep 17 00:00:00 2001 From: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com> Date: Wed, 25 Feb 2026 15:11:52 -0500 Subject: [PATCH] [lightwaverf] Fix millis overflow in send timeout check (#14294) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- esphome/components/lightwaverf/lightwaverf.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/esphome/components/lightwaverf/lightwaverf.cpp b/esphome/components/lightwaverf/lightwaverf.cpp index 2b44195c97..2c6a1ecf5b 100644 --- a/esphome/components/lightwaverf/lightwaverf.cpp +++ b/esphome/components/lightwaverf/lightwaverf.cpp @@ -31,13 +31,12 @@ void LightWaveRF::read_tx() { void LightWaveRF::send_rx(const std::vector &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;