From 44e9346e9c7224ca962d608b1cb10fb9c936c7d5 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 9 Feb 2026 09:30:43 -0600 Subject: [PATCH] Add comment explaining early guard --- esphome/components/modbus/modbus.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esphome/components/modbus/modbus.cpp b/esphome/components/modbus/modbus.cpp index a2bfcf32922..ccfa589b90d 100644 --- a/esphome/components/modbus/modbus.cpp +++ b/esphome/components/modbus/modbus.cpp @@ -19,6 +19,8 @@ void Modbus::setup() { void Modbus::loop() { const uint32_t now = App.get_loop_component_start_time(); + // 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) { // Read all available bytes in batches to reduce UART call overhead.