1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-14 09:12:19 +01:00
This commit is contained in:
J. Nick Koston
2025-06-15 18:37:05 -05:00
parent 8a06c4380d
commit cee7789ab6
2 changed files with 9 additions and 0 deletions

View File

@@ -572,6 +572,9 @@ class Application {
void calculate_looping_components_();
// 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);

View File

@@ -155,6 +155,9 @@ class Component {
*
* This is useful for components that only need to run for a certain period of time
* or when inactive, saving CPU cycles.
*
* @note Components should call this->disable_loop() on themselves, not on other components.
* This ensures the component's state is properly updated along with the loop partition.
*/
void disable_loop();
@@ -162,6 +165,9 @@ class Component {
*
* This is useful for components that transition between active and inactive states
* and need to re-enable their loop() method when becoming active again.
*
* @note Components should call this->enable_loop() on themselves, not on other components.
* This ensures the component's state is properly updated along with the loop partition.
*/
void enable_loop();