diff --git a/esphome/components/esp8266/core.cpp b/esphome/components/esp8266/core.cpp index 27f9c2393f..389560cb1a 100644 --- a/esphome/components/esp8266/core.cpp +++ b/esphome/components/esp8266/core.cpp @@ -15,7 +15,9 @@ extern "C" { namespace esphome { -// yield(), delay(), micros(), millis(), millis_64() inlined in hal.h. +// yield(), micros(), millis_64() inlined in hal.h. +uint32_t IRAM_ATTR HOT millis() { return ::millis(); } +void HOT delay(uint32_t ms) { ::delay(ms); } void IRAM_ATTR HOT delayMicroseconds(uint32_t us) { delay_microseconds_safe(us); } void arch_restart() { system_restart(); diff --git a/esphome/core/hal.h b/esphome/core/hal.h index c039eba19a..66b4f72d4b 100644 --- a/esphome/core/hal.h +++ b/esphome/core/hal.h @@ -142,12 +142,13 @@ __attribute__((always_inline)) inline uint64_t millis_64() { } #elif defined(USE_ESP8266) || defined(USE_LIBRETINY) || defined(USE_RP2040) __attribute__((always_inline)) inline void yield() { ::yield(); } -__attribute__((always_inline)) inline void delay(uint32_t ms) { ::delay(ms); } __attribute__((always_inline)) inline uint32_t micros() { return static_cast(::micros()); } #if defined(USE_ESP8266) -__attribute__((always_inline)) inline uint32_t millis() { return static_cast(::millis()); } +void delay(uint32_t ms); +uint32_t millis(); __attribute__((always_inline)) inline uint64_t millis_64() { return Millis64Impl::compute(millis()); } #elif defined(USE_LIBRETINY) +__attribute__((always_inline)) inline void delay(uint32_t ms) { ::delay(ms); } // Per-variant millis() fast path — matches MillisInternal::get(). #if defined(USE_RTL87XX) || defined(USE_LN882X) static_assert(configTICK_RATE_HZ == 1000, "millis() fast path requires 1 kHz FreeRTOS tick");