Add comment explaining early guard

This commit is contained in:
J. Nick Koston
2026-02-09 09:30:08 -06:00
parent 5e096826c3
commit 6013b473ca
3 changed files with 6 additions and 0 deletions

View File

@@ -106,6 +106,8 @@ void MR24HPC1Component::update_() {
// main loop
void MR24HPC1Component::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) {
// Read all available bytes in batches to reduce UART call overhead.

View File

@@ -30,6 +30,8 @@ void MR60BHA2Component::dump_config() {
// main loop
void MR60BHA2Component::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;

View File

@@ -49,6 +49,8 @@ void MR60FDA2Component::setup() {
// main loop
void MR60FDA2Component::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;