mirror of
https://github.com/esphome/esphome.git
synced 2026-09-14 16:48:40 +00:00
[esp8266] Revert init() wrap — micros64() needs the overflow timer
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).
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user