From 836bfc625de90c405aa8ded9ab8b835f7fcd3200 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 7 Feb 2026 01:01:03 +0100 Subject: [PATCH] restore original byte-at-a-time read in send_cmd_from_array ack loop The ack polling loop has a tight timing requirement with delay_microseconds_safe(1450) between iterations. Snapshotting available() once could leave partial ack response bytes unread until after the delay, potentially breaking cold boot timing on some ld2420 units. Keep batch reads only in loop(). --- esphome/components/ld2420/ld2420.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/components/ld2420/ld2420.cpp b/esphome/components/ld2420/ld2420.cpp index 2abeccc7ac..01f05b21e5 100644 --- a/esphome/components/ld2420/ld2420.cpp +++ b/esphome/components/ld2420/ld2420.cpp @@ -667,7 +667,9 @@ int LD2420Component::send_cmd_from_array(CmdFrameT frame) { } while (!this->cmd_reply_.ack) { - this->read_batch_(ack_buffer); + while (this->available()) { + this->readline_(this->read(), ack_buffer, sizeof(ack_buffer)); + } delay_microseconds_safe(1450); // Wait on an Rx from the LD2420 for up to 3 1 second loops, otherwise it could trigger a WDT. if ((millis() - start_millis) > 1000) {