From f79448a09aadfa5b1a60f1517f3aa38bc0455bcc Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 9 Feb 2026 09:27:57 -0600 Subject: [PATCH 1/3] Remove verbose available() comment --- esphome/components/rd03d/rd03d.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/esphome/components/rd03d/rd03d.cpp b/esphome/components/rd03d/rd03d.cpp index 5e644e537e..1b3212e2c0 100644 --- a/esphome/components/rd03d/rd03d.cpp +++ b/esphome/components/rd03d/rd03d.cpp @@ -81,8 +81,6 @@ void RD03DComponent::dump_config() { } void RD03DComponent::loop() { - // All current UART available() implementations return >= 0, - // use <= 0 to future-proof against any that may return negative on error. int avail = this->available(); if (avail <= 0) return; From 6670c2b6c422a1b9961a4484fbdc7d6a6589b5bf Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 9 Feb 2026 09:30:24 -0600 Subject: [PATCH 2/3] Add comment explaining early guard --- esphome/components/rd03d/rd03d.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esphome/components/rd03d/rd03d.cpp b/esphome/components/rd03d/rd03d.cpp index 1b3212e2c0..90ac87f93f 100644 --- a/esphome/components/rd03d/rd03d.cpp +++ b/esphome/components/rd03d/rd03d.cpp @@ -81,6 +81,8 @@ void RD03DComponent::dump_config() { } void RD03DComponent::loop() { + // Early return avoids stack adjustment for the batch buffer below. + // loop() runs ~7000/min so most calls have nothing to read. int avail = this->available(); if (avail <= 0) return; From a198df34eec6f6988faa259533c5e3734979ec55 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 9 Feb 2026 09:39:49 -0600 Subject: [PATCH 3/3] Remove unnecessary early guard --- esphome/components/rd03d/rd03d.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/esphome/components/rd03d/rd03d.cpp b/esphome/components/rd03d/rd03d.cpp index 90ac87f93f..e4dbdf41cb 100644 --- a/esphome/components/rd03d/rd03d.cpp +++ b/esphome/components/rd03d/rd03d.cpp @@ -81,12 +81,8 @@ void RD03DComponent::dump_config() { } void RD03DComponent::loop() { - // Early return avoids stack adjustment for the batch buffer below. - // loop() runs ~7000/min so most calls have nothing to read. + // Read all available bytes in batches to reduce UART call overhead. int avail = this->available(); - if (avail <= 0) - return; - uint8_t buf[64]; while (avail > 0) { size_t to_read = std::min(static_cast(avail), sizeof(buf));