From fd31afe09cfe93110a480fffbee97bdeeb8681a8 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 15 Jun 2025 18:58:32 -0500 Subject: [PATCH] tidy --- esphome/core/application.cpp | 4 ++-- esphome/core/application.h | 4 ++-- esphome/core/component.cpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/esphome/core/application.cpp b/esphome/core/application.cpp index a47bfdf484..74208bbe22 100644 --- a/esphome/core/application.cpp +++ b/esphome/core/application.cpp @@ -251,7 +251,7 @@ void Application::calculate_looping_components_() { this->looping_components_active_end_ = this->looping_components_.size(); } -void Application::disable_component_loop(Component *component) { +void Application::disable_component_loop_(Component *component) { // This method must be reentrant - components can disable themselves during their own loop() call // Linear search to find component in active section // Most configs have 10-30 looping components (30 is on the high end) @@ -274,7 +274,7 @@ void Application::disable_component_loop(Component *component) { } } -void Application::enable_component_loop(Component *component) { +void Application::enable_component_loop_(Component *component) { // This method must be reentrant - components can re-enable themselves during their own loop() call // Single pass through all components to find and move if needed // With typical 10-30 components, O(n) is faster than maintaining a map diff --git a/esphome/core/application.h b/esphome/core/application.h index fc6f53a7c8..ea298638d2 100644 --- a/esphome/core/application.h +++ b/esphome/core/application.h @@ -575,8 +575,8 @@ class Application { // These methods are called by Component::disable_loop() and Component::enable_loop() // Components should not call these directly - use this->disable_loop() or this->enable_loop() // to ensure component state is properly updated along with the loop partition - void disable_component_loop(Component *component); - void enable_component_loop(Component *component); + void disable_component_loop_(Component *component); + void enable_component_loop_(Component *component); void feed_wdt_arch_(); diff --git a/esphome/core/component.cpp b/esphome/core/component.cpp index 2284a53fcd..3117f49ac1 100644 --- a/esphome/core/component.cpp +++ b/esphome/core/component.cpp @@ -145,20 +145,20 @@ void Component::mark_failed() { this->component_state_ |= COMPONENT_STATE_FAILED; this->status_set_error(); // Also remove from loop since failed components shouldn't loop - App.disable_component_loop(this); + App.disable_component_loop_(this); } void Component::disable_loop() { ESP_LOGD(TAG, "%s loop disabled", this->get_component_source()); this->component_state_ &= ~COMPONENT_STATE_MASK; this->component_state_ |= COMPONENT_STATE_LOOP_DONE; - App.disable_component_loop(this); + App.disable_component_loop_(this); } void Component::enable_loop() { if ((this->component_state_ & COMPONENT_STATE_MASK) == COMPONENT_STATE_LOOP_DONE) { ESP_LOGD(TAG, "%s loop enabled", this->get_component_source()); this->component_state_ &= ~COMPONENT_STATE_MASK; this->component_state_ |= COMPONENT_STATE_LOOP; - App.enable_component_loop(this); + App.enable_component_loop_(this); } } void Component::reset_to_construction_state() {