mirror of
https://github.com/esphome/esphome.git
synced 2026-02-26 05:53:12 -07:00
Add comment explaining early guard
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user