From bf2040355867b823859e06bf3708ac444476e60f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 11 Apr 2026 23:08:53 -1000 Subject: [PATCH] =?UTF-8?q?[esp8266]=20Revert=20init()=20wrap=20=E2=80=94?= =?UTF-8?q?=20micros64()=20needs=20the=20overflow=20timer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Arduino's micros64() reads the same overflow tracking statics that init() sets up. Wrapping init() as a no-op would cause micros64() to silently return wrong values after 71 minutes. The overflow timer cost is negligible (~3 μs per 60 seconds). --- esphome/components/esp8266/core.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/esphome/components/esp8266/core.cpp b/esphome/components/esp8266/core.cpp index 2a5349b143..6df0db7a1c 100644 --- a/esphome/components/esp8266/core.cpp +++ b/esphome/components/esp8266/core.cpp @@ -132,5 +132,8 @@ extern "C" void resetPins() { // NOLINT // Requires -Wl,--wrap=millis in build flags (added by __init__.py). // NOLINTNEXTLINE(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp,readability-identifier-naming) extern "C" uint32_t IRAM_ATTR __wrap_millis() { return esphome::millis(); } +// Note: Arduino's init() registers a 60-second overflow timer for micros64(). +// We leave it running — wrapping init() as a no-op would break micros64()'s +// overflow tracking, and the timer's cost is negligible (~3 μs per 60 s). #endif // USE_ESP8266