diff --git a/esphome/core/component.cpp b/esphome/core/component.cpp index ed186f9c20..2d61843585 100644 --- a/esphome/core/component.cpp +++ b/esphome/core/component.cpp @@ -522,7 +522,7 @@ void PollingComponent::stop_poller() { uint32_t PollingComponent::get_update_interval() const { return this->update_interval_; } void PollingComponent::set_update_interval(uint32_t update_interval) { this->update_interval_ = update_interval; } -void __attribute__((noinline, cold)) warn_if_blocking(Component *component, uint32_t blocking_time) { +void __attribute__((noinline, cold)) warn_blocking(Component *component, uint32_t blocking_time) { bool should_warn; if (component != nullptr) { should_warn = component->should_warn_of_blocking(blocking_time); diff --git a/esphome/core/component.h b/esphome/core/component.h index a1eaca022d..20a6d2311d 100644 --- a/esphome/core/component.h +++ b/esphome/core/component.h @@ -6,6 +6,7 @@ #include #include "esphome/core/defines.h" +#include "esphome/core/hal.h" #include "esphome/core/helpers.h" #include "esphome/core/log.h" #include "esphome/core/optional.h" @@ -574,13 +575,10 @@ class PollingComponent : public Component { uint32_t update_interval_; }; -uint32_t millis(); // Forward declare for inline finish() -#ifdef USE_RUNTIME_STATS -uint32_t micros(); // Forward declare for inline constructor -#endif +// millis() and micros() are available via hal.h // Cold path for blocking warning - defined in component.cpp -void warn_if_blocking(Component *component, uint32_t blocking_time); +void warn_blocking(Component *component, uint32_t blocking_time); class WarnIfComponentBlockingGuard { public: @@ -603,7 +601,7 @@ class WarnIfComponentBlockingGuard { this->record_runtime_stats_(); #endif if (blocking_time > WARN_IF_BLOCKING_OVER_MS) [[unlikely]] { - warn_if_blocking(this->component_, blocking_time); + warn_blocking(this->component_, blocking_time); } return curr_time; }