1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 00:31:58 +00:00

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().
This commit is contained in:
J. Nick Koston
2026-02-07 01:01:03 +01:00
parent 26c98a1e25
commit 836bfc625d

View File

@@ -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) {