ESPHome 2026.5.0-dev
Loading...
Searching...
No Matches
component.h
Go to the documentation of this file.
1#pragma once
2
3#include <cmath>
4#include <cstdint>
5#include <functional>
6#include <string>
7
9#include "esphome/core/hal.h"
11#include "esphome/core/log.h"
13
14// Forward declarations for friend access from codegen-generated setup()
15void setup(); // NOLINT(readability-redundant-declaration) - may be declared in Arduino.h
16void original_setup(); // NOLINT(readability-redundant-declaration)
17
18namespace esphome {
19
20// Forward declaration for LogString
21struct LogString;
22
23#ifdef USE_RUNTIME_STATS
24namespace runtime_stats {
25class RuntimeStatsCollector;
26} // namespace runtime_stats
27#endif
28
33namespace setup_priority {
34
36inline constexpr float BUS = 1000.0f;
38inline constexpr float IO = 900.0f;
40inline constexpr float HARDWARE = 800.0f;
42inline constexpr float DATA = 600.0f;
44inline constexpr float PROCESSOR = 400.0f;
45inline constexpr float BLUETOOTH = 350.0f;
46inline constexpr float AFTER_BLUETOOTH = 300.0f;
47inline constexpr float WIFI = 250.0f;
48inline constexpr float ETHERNET = 250.0f;
50inline constexpr float BEFORE_CONNECTION = 220.0f;
52inline constexpr float AFTER_WIFI = 200.0f;
54inline constexpr float AFTER_CONNECTION = 100.0f;
56inline constexpr float LATE = -100.0f;
57
58} // namespace setup_priority
59
60inline constexpr uint32_t SCHEDULER_DONT_RUN = 4294967295UL;
61
66 POLLING_UPDATE = 0, // PollingComponent interval
67 DELAY_ACTION = 1, // DelayAction timeout
68};
69
70// Forward declaration
71class PollingComponent;
72
73// Function declaration for LOG_UPDATE_INTERVAL
74void log_update_interval(const char *tag, PollingComponent *component);
75
76#define LOG_UPDATE_INTERVAL(this) log_update_interval(TAG, this)
77
78// Component state uses bits 0-2 (8 states, 5 used)
79inline constexpr uint8_t COMPONENT_STATE_MASK = 0x07;
80inline constexpr uint8_t COMPONENT_STATE_CONSTRUCTION = 0x00;
81inline constexpr uint8_t COMPONENT_STATE_SETUP = 0x01;
82inline constexpr uint8_t COMPONENT_STATE_LOOP = 0x02;
83inline constexpr uint8_t COMPONENT_STATE_FAILED = 0x03;
84inline constexpr uint8_t COMPONENT_STATE_LOOP_DONE = 0x04;
85// Status LED uses bits 3-4
86inline constexpr uint8_t STATUS_LED_MASK = 0x18;
87inline constexpr uint8_t STATUS_LED_OK = 0x00;
88inline constexpr uint8_t STATUS_LED_WARNING = 0x08;
89inline constexpr uint8_t STATUS_LED_ERROR = 0x10;
90// Component loop override flag uses bit 5 (set at registration time)
91inline constexpr uint8_t COMPONENT_HAS_LOOP = 0x20;
92// Bit 6 on Application::app_state_ (ONLY) — set at the end of
93// Application::setup(). Component::status_clear_*_slow_path_() uses this to
94// decide whether to propagate clears to App.app_state_. Never set on a
95// Component's component_state_.
96inline constexpr uint8_t APP_STATE_SETUP_COMPLETE = 0x40;
97// Remove before 2026.8.0
98enum class RetryResult { DONE, RETRY };
99
100inline constexpr uint8_t WARN_IF_BLOCKING_OVER_CS = 5U; // 50ms in centiseconds (1cs = 10ms)
101
104const LogString *component_source_lookup(uint8_t index);
105
106#ifdef USE_RUNTIME_STATS
110 // Period stats (reset each logging interval)
114 // Total stats (persistent until reboot, uint64_t to avoid overflow)
116 uint64_t total_time_us{0};
118
119 // Cumulative sum of every record_time() duration since boot, across all
120 // components. Used by Application::loop() to snapshot time spent inside
121 // WarnIfComponentBlockingGuard (including guards constructed by the
122 // scheduler at scheduler.cpp) so main-loop overhead accounting can
123 // subtract scheduled-callback time from the before_loop_tasks_ wall time.
124 static uint64_t global_recorded_us; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
125
126 void record_time(uint32_t duration_us) {
127 this->period_count++;
128 this->period_time_us += duration_us;
129 if (duration_us > this->period_max_time_us)
130 this->period_max_time_us = duration_us;
131 this->total_count++;
132 this->total_time_us += duration_us;
133 if (duration_us > this->total_max_time_us)
134 this->total_max_time_us = duration_us;
135 global_recorded_us += duration_us;
136 }
138 this->period_count = 0;
139 this->period_time_us = 0;
140 this->period_max_time_us = 0;
141 }
142};
143#endif
144
146 public:
152 virtual void setup();
153
159 virtual void loop();
160
161 virtual void dump_config();
162
169 virtual float get_setup_priority() const;
170
171 float get_actual_setup_priority() const;
172
173 void set_setup_priority(float priority);
174
175 void call();
176
177 virtual void on_shutdown() {}
178 virtual void on_safe_shutdown() {}
179
184 virtual bool teardown() { return true; }
185
191 virtual void on_powerdown() {}
192
193 uint8_t get_component_state() const { return this->component_state_; }
194
200
205 bool is_in_loop_state() const { return (this->component_state_ & COMPONENT_STATE_MASK) == COMPONENT_STATE_LOOP; }
206
213 bool is_idle() const { return (this->component_state_ & COMPONENT_STATE_MASK) == COMPONENT_STATE_LOOP_DONE; }
214
221 void mark_failed();
222
223 // Remove before 2026.6.0
224 ESPDEPRECATED("Use mark_failed(LOG_STR(\"static string literal\")) instead. Do NOT use .c_str() from temporary "
225 "strings. Will stop working in 2026.6.0",
226 "2025.12.0")
227 void mark_failed(const char *message) {
228#pragma GCC diagnostic push
229#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
230 this->status_set_error(message);
231#pragma GCC diagnostic pop
232 this->mark_failed();
233 }
234
235 void mark_failed(const LogString *message) {
236 this->status_set_error(message);
237 this->mark_failed();
238 }
239
248 void disable_loop();
249
258 void enable_loop() {
259 if ((this->component_state_ & COMPONENT_STATE_MASK) == COMPONENT_STATE_LOOP_DONE)
261 }
262
283
284 bool is_failed() const { return (this->component_state_ & COMPONENT_STATE_MASK) == COMPONENT_STATE_FAILED; }
285
286 bool is_ready() const;
287
288 virtual bool can_proceed();
289
291
292 bool status_has_error() const { return this->component_state_ & STATUS_LED_ERROR; }
293
294 void status_set_warning(); // Set warning flag without message
295 void status_set_warning(const char *message);
296 void status_set_warning(const LogString *message);
297
298 void status_set_error(); // Set error flag without message
299 // Remove before 2026.6.0
300 ESPDEPRECATED("Use status_set_error(LOG_STR(\"static string literal\")) instead. Do NOT use .c_str() from temporary "
301 "strings. Will stop working in 2026.6.0",
302 "2025.12.0")
303 void status_set_error(const char *message);
304 void status_set_error(const LogString *message);
305
307 if ((this->component_state_ & STATUS_LED_WARNING) == 0)
308 return;
310 }
311
313 if ((this->component_state_ & STATUS_LED_ERROR) == 0)
314 return;
316 }
317
325 void status_momentary_warning(const char *name, uint32_t length = 5000);
326
334 void status_momentary_error(const char *name, uint32_t length = 5000);
335
336 bool has_overridden_loop() const { return (this->component_state_ & COMPONENT_HAS_LOOP) != 0; }
337
342 inline const LogString *get_component_log_str() const ESPHOME_ALWAYS_INLINE {
344 }
345
346 bool should_warn_of_blocking(uint32_t blocking_time);
347
348 protected:
349 friend class Application;
350 friend void ::setup();
351 friend void ::original_setup();
352
358 void set_component_source_(uint8_t index) { this->component_source_index_ = index; }
359
360 virtual void call_setup();
361 void call_dump_config_();
362
364
366 inline void set_component_state_(uint8_t state) {
367 this->component_state_ &= ~COMPONENT_STATE_MASK;
368 this->component_state_ |= state;
369 }
370
375 bool set_status_flag_(uint8_t flag);
376
399 // Remove before 2026.7.0
400 ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0")
401 void set_interval(const std::string &name, uint32_t interval, std::function<void()> &&f); // NOLINT
402
417 void set_interval(const char *name, uint32_t interval, std::function<void()> &&f); // NOLINT
418
425 void set_interval(uint32_t id, uint32_t interval, std::function<void()> &&f); // NOLINT
426
427 void set_interval(InternalSchedulerID id, uint32_t interval, std::function<void()> &&f); // NOLINT
428
429 void set_interval(uint32_t interval, std::function<void()> &&f); // NOLINT
430
436 // Remove before 2026.7.0
437 ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0")
438 bool cancel_interval(const std::string &name); // NOLINT
439 bool cancel_interval(const char *name); // NOLINT
440 bool cancel_interval(uint32_t id); // NOLINT
442
444 // Remove before 2026.8.0
445 ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.",
446 "2026.2.0")
447 void set_retry(const std::string &name, uint32_t initial_wait_time, uint8_t max_attempts, // NOLINT
448 std::function<RetryResult(uint8_t)> &&f, float backoff_increase_factor = 1.0f); // NOLINT
449
450 // Remove before 2026.8.0
451 ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.",
452 "2026.2.0")
453 void set_retry(const char *name, uint32_t initial_wait_time, uint8_t max_attempts, // NOLINT
454 std::function<RetryResult(uint8_t)> &&f, float backoff_increase_factor = 1.0f); // NOLINT
455
456 // Remove before 2026.8.0
457 ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.",
458 "2026.2.0")
459 void set_retry(uint32_t id, uint32_t initial_wait_time, uint8_t max_attempts, // NOLINT
460 std::function<RetryResult(uint8_t)> &&f, float backoff_increase_factor = 1.0f); // NOLINT
461
462 // Remove before 2026.8.0
463 ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.",
464 "2026.2.0")
465 void set_retry(uint32_t initial_wait_time, uint8_t max_attempts, std::function<RetryResult(uint8_t)> &&f, // NOLINT
466 float backoff_increase_factor = 1.0f); // NOLINT
467
468 // Remove before 2026.8.0
469 ESPDEPRECATED("cancel_retry is deprecated and will be removed in 2026.8.0.", "2026.2.0")
470 bool cancel_retry(const std::string &name); // NOLINT
471 // Remove before 2026.8.0
472 ESPDEPRECATED("cancel_retry is deprecated and will be removed in 2026.8.0.", "2026.2.0")
473 bool cancel_retry(const char *name); // NOLINT
474 // Remove before 2026.8.0
475 ESPDEPRECATED("cancel_retry is deprecated and will be removed in 2026.8.0.", "2026.2.0")
476 bool cancel_retry(uint32_t id); // NOLINT
477
492 // Remove before 2026.7.0
493 ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0")
494 void set_timeout(const std::string &name, uint32_t timeout, std::function<void()> &&f); // NOLINT
495
510 void set_timeout(const char *name, uint32_t timeout, std::function<void()> &&f); // NOLINT
511
518 void set_timeout(uint32_t id, uint32_t timeout, std::function<void()> &&f); // NOLINT
519
520 void set_timeout(InternalSchedulerID id, uint32_t timeout, std::function<void()> &&f); // NOLINT
521
522 void set_timeout(uint32_t timeout, std::function<void()> &&f); // NOLINT
523
529 // Remove before 2026.7.0
530 ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0")
531 bool cancel_timeout(const std::string &name); // NOLINT
532 bool cancel_timeout(const char *name); // NOLINT
533 bool cancel_timeout(uint32_t id); // NOLINT
535
543 // Remove before 2026.7.0
544 ESPDEPRECATED("Use const char* overload instead. Removed in 2026.7.0", "2026.1.0")
545 void defer(const std::string &name, std::function<void()> &&f); // NOLINT
546
560 void defer(const char *name, std::function<void()> &&f); // NOLINT
561
563 void defer(std::function<void()> &&f); // NOLINT
564
566 void defer(uint32_t id, std::function<void()> &&f); // NOLINT
567
569 // Remove before 2026.7.0
570 ESPDEPRECATED("Use const char* overload instead. Removed in 2026.7.0", "2026.1.0")
571 bool cancel_defer(const std::string &name); // NOLINT
572 bool cancel_defer(const char *name); // NOLINT
573 bool cancel_defer(uint32_t id); // NOLINT
574
577
578 // Ordered for optimal packing on 32-bit systems (8 bytes total with vtable)
587 uint8_t component_state_{0x00};
588 volatile bool pending_enable_loop_{false};
589#ifdef USE_RUNTIME_STATS
593#endif
594};
595
603 public:
605
610 explicit PollingComponent(uint32_t update_interval);
611
616 void set_update_interval(uint32_t update_interval) { this->update_interval_ = update_interval; }
617
618 // ========== OVERRIDE METHODS ==========
619 // (You'll only need this when creating your own custom sensor)
620 virtual void update() = 0;
621
622 // ========== INTERNAL METHODS ==========
623 // (In most use cases you won't need these)
624 void call_setup() override;
625
627 virtual uint32_t get_update_interval() const;
628
629 // Start the poller, used for component.suspend
630 void start_poller();
631
632 // Stop the poller, used for component.suspend
633 void stop_poller();
634
635 protected:
637};
638
639// millis() and micros() are available via hal.h
640
642 public:
644 : started_(start_time),
646#ifdef USE_RUNTIME_STATS
647 ,
649#endif
650 {
651 }
652
653 // Finish the timing operation and return the current time (millis)
654 // Inlined: the fast path is just millis() + subtract + compare
655 inline uint32_t HOT finish() {
656#ifdef USE_RUNTIME_STATS
658#endif
659 uint32_t curr_time = millis();
660#ifndef USE_BENCHMARK
661 // Fast path: compare against constant threshold in ms (computed at compile time from centiseconds)
662 static constexpr uint32_t WARN_IF_BLOCKING_OVER_MS = static_cast<uint32_t>(WARN_IF_BLOCKING_OVER_CS) * 10U;
663 uint32_t blocking_time = curr_time - this->started_;
664 if (blocking_time > WARN_IF_BLOCKING_OVER_MS) [[unlikely]] {
665 warn_blocking(this->component_, blocking_time);
666 }
667#endif
668 return curr_time;
669 }
670
672
673 protected:
676#ifdef USE_RUNTIME_STATS
678#endif
679
680 private:
681 // Cold path for blocking warning - defined in component.cpp
682 static void __attribute__((noinline, cold)) warn_blocking(Component *component, uint32_t blocking_time);
683};
684
685// Function to clear setup priority overrides after all components are set up
686// Only has an implementation when USE_SETUP_PRIORITY_OVERRIDE is defined
688
689} // namespace esphome
void mark_failed()
Mark this component as failed.
void status_momentary_error(const char *name, uint32_t length=5000)
Set error status flag and automatically clear it after a timeout.
ESPDEPRECATED("Use status_set_error(LOG_STR(\"static string literal\")) instead. Do NOT use .c_str() from temporary " "strings. Will stop working in 2026.6.0", "2025.12.0") void status_set_error(const char *message)
virtual float get_setup_priority() const
priority of setup().
Definition component.cpp:87
virtual void setup()
Where the component's initialization should happen.
Definition component.cpp:89
float get_actual_setup_priority() const
bool has_overridden_loop() const
Definition component.h:336
void mark_failed(const LogString *message)
Definition component.h:235
virtual void on_powerdown()
Called after teardown is complete to power down hardware.
Definition component.h:191
ESPDEPRECATED("Use const char* overload instead. Removed in 2026.7.0", "2026.1.0") void defer(const std voi defer)(const char *name, std::function< void()> &&f)
Defer a callback to the next loop() call.
Definition component.h:560
bool set_status_flag_(uint8_t flag)
Helper to set a status LED flag on both this component and the app.
ComponentRuntimeStats runtime_stats_
Definition component.h:592
bool is_failed() const
Definition component.h:284
uint8_t get_component_state() const
Definition component.h:193
void enable_loop_slow_path_()
bool should_warn_of_blocking(uint32_t blocking_time)
volatile bool pending_enable_loop_
ISR-safe flag for enable_loop_soon_any_context.
Definition component.h:588
virtual bool can_proceed()
virtual void on_safe_shutdown()
Definition component.h:178
ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") void set_timeout(const std voi set_timeout)(const char *name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
Definition component.h:510
void status_clear_error()
Definition component.h:312
ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") void set_interval(const std voi set_interval)(const char *name, uint32_t interval, std::function< void()> &&f)
Set an interval function with a unique name.
Definition component.h:417
void set_component_source_(uint8_t index)
Set where this component was loaded from for some debug messages.
Definition component.h:358
bool is_in_loop_state() const
Check if this component has completed setup and is in the loop state.
Definition component.h:205
virtual bool teardown()
Called during teardown to allow component to gracefully finish operations.
Definition component.h:184
ESPDEPRECATED("Use const char* overload instead. Removed in 2026.7.0", "2026.1.0") bool cancel_defer(const std boo cancel_defer)(const char *name)
Cancel a defer callback using the specified name, name must not be empty.
Definition component.h:572
void enable_loop_soon_any_context()
Thread and ISR-safe version of enable_loop() that can be called from any context.
uint8_t component_state_
State of this component - each bit has a purpose: Bits 0-2: Component state (0x00=CONSTRUCTION,...
Definition component.h:587
void status_momentary_warning(const char *name, uint32_t length=5000)
Set warning status flag and automatically clear it after a timeout.
bool is_ready() const
virtual void dump_config()
void enable_loop()
Enable this component's loop.
Definition component.h:258
const LogString * get_component_log_str() const ESPHOME_ALWAYS_INLINE
Get the integration where this component was declared as a LogString for logging.
Definition component.h:342
uint8_t component_source_index_
Index into component source PROGMEM lookup table (0 = not set)
Definition component.h:579
void status_clear_warning_slow_path_()
void set_component_state_(uint8_t state)
Helper to set component state (clears state bits and sets new state)
Definition component.h:366
bool status_has_warning() const
Definition component.h:290
ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std uint32_t uint8_t std::function< RetryResult(uint8_t)> float backoff_increase_factor
Definition component.h:454
bool status_has_error() const
Definition component.h:292
void status_clear_error_slow_path_()
void disable_loop()
Disable this component's loop.
virtual void on_shutdown()
Definition component.h:177
ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std uint32_t initial_wait_time
Definition component.h:453
virtual void loop()
This method will be called repeatedly.
Definition component.cpp:91
ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") bool cancel_timeout(const std boo cancel_timeout)(const char *name)
Cancel a timeout function.
Definition component.h:532
ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std uint32_t uint8_t max_attempts
Definition component.h:453
void reset_to_construction_state()
Reset this component back to the construction state to allow setup to run again.
uint8_t warn_if_blocking_over_
Warn threshold in centiseconds (max 2550ms)
Definition component.h:580
void set_setup_priority(float priority)
ESPDEPRECATED("Use mark_failed(LOG_STR(\"static string literal\")) instead. Do NOT use .c_str() from temporary " "strings. Will stop working in 2026.6.0", "2025.12.0") void mark_failed(const char *message)
Definition component.h:224
ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") bool cancel_interval(const std boo cancel_interval)(const char *name)
Cancel an interval function.
Definition component.h:439
ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std uint32_t uint8_t std::function< RetryResult(uint8_t)> && f
Definition component.h:454
void status_clear_warning()
Definition component.h:306
virtual void call_setup()
bool is_idle() const
Check if this component is idle.
Definition component.h:213
This class simplifies creating components that periodically check a state.
Definition component.h:602
virtual uint32_t get_update_interval() const
Get the update interval in ms of this sensor.
void call_setup() override
void set_update_interval(uint32_t update_interval)
Manually set the update interval in ms for this polling object.
Definition component.h:616
virtual void update()=0
WarnIfComponentBlockingGuard(Component *component, uint32_t start_time)
Definition component.h:643
struct @65::@66 __attribute__
Wake the main loop task from an ISR. ISR-safe.
Definition main_task.h:32
const Component * component
Definition component.cpp:34
const char * message
Definition component.cpp:35
void original_setup()
void setup()
uint8_t priority
bool state
Definition fan.h:2
constexpr float BEFORE_CONNECTION
For components that should be initialized after WiFi and before API is connected.
Definition component.h:50
constexpr float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition component.h:40
constexpr float WIFI
Definition component.h:47
constexpr float ETHERNET
Definition component.h:48
constexpr float AFTER_BLUETOOTH
Definition component.h:46
constexpr float AFTER_WIFI
For components that should be initialized after WiFi is connected.
Definition component.h:52
constexpr float LATE
For components that should be initialized at the very end of the setup process.
Definition component.h:56
constexpr float DATA
For components that import data from directly connected sensors like DHT.
Definition component.h:42
constexpr float PROCESSOR
For components that use data from sensors like displays.
Definition component.h:44
constexpr float BLUETOOTH
Definition component.h:45
constexpr float BUS
For communication buses like i2c/spi.
Definition component.h:36
constexpr float IO
For components that represent GPIO pins like PCF8573.
Definition component.h:38
constexpr float AFTER_CONNECTION
For components that should be initialized after a data connection (API/MQTT) is connected.
Definition component.h:54
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
const char * tag
Definition log.h:74
constexpr uint8_t COMPONENT_STATE_FAILED
Definition component.h:83
constexpr uint8_t WARN_IF_BLOCKING_OVER_CS
Definition component.h:100
constexpr uint8_t COMPONENT_HAS_LOOP
Definition component.h:91
InternalSchedulerID
Type-safe scheduler IDs for core base classes.
Definition component.h:65
constexpr uint8_t STATUS_LED_MASK
Definition component.h:86
constexpr uint8_t COMPONENT_STATE_LOOP
Definition component.h:82
constexpr uint8_t APP_STATE_SETUP_COMPLETE
Definition component.h:96
constexpr uint8_t STATUS_LED_WARNING
Definition component.h:88
constexpr uint8_t COMPONENT_STATE_MASK
Definition component.h:79
void log_update_interval(const char *tag, PollingComponent *component)
void clear_setup_priority_overrides()
uint32_t IRAM_ATTR HOT micros()
Definition core.cpp:29
const LogString * component_source_lookup(uint8_t index)
Lookup component source name by index (1-based).
constexpr uint8_t COMPONENT_STATE_LOOP_DONE
Definition component.h:84
uint32_t IRAM_ATTR HOT millis()
Definition core.cpp:26
constexpr uint8_t COMPONENT_STATE_SETUP
Definition component.h:81
constexpr uint8_t COMPONENT_STATE_CONSTRUCTION
Definition component.h:80
constexpr uint8_t STATUS_LED_OK
Definition component.h:87
constexpr uint8_t STATUS_LED_ERROR
Definition component.h:89
constexpr uint32_t SCHEDULER_DONT_RUN
Definition component.h:60
static void uint32_t
Inline runtime statistics — eliminates std::map lookup on every loop iteration.
Definition component.h:109
static uint64_t global_recorded_us
Definition component.h:124
void record_time(uint32_t duration_us)
Definition component.h:126
uint16_t length
Definition tt21100.cpp:0