RP2040's Pico SDK provides time_us_64() which reads the hardware
timer registers directly, returning native uint64_t microseconds.
This eliminates the need for 32-bit rollover tracking on this
platform.
millis() is now derived from millis_64() (like Zephyr) instead of
the other way around, unifying the time source.
Also removes IRAM_ATTR from all RP2040 HAL functions. On RP2040,
IRAM_ATTR is a no-op: the functions it decorated (millis, micros,
delayMicroseconds, arch_get_cpu_cycle_count) all call into Pico SDK
functions that reside in flash (XIP), so the attribute had no effect.
Remove virtual from Component::call_dump_config() since only
MQTTComponent overrode it. The MQTT override skipped dump_config
for internal entities, which unnecessarily hid useful debug info
from startup logs. The is_internal flag means "don't expose to
Home Assistant", not "don't log config".
This also removes one vtable entry from every Component subclass
and eliminates the indirect call overhead.
Replace floating-point arithmetic with integer weighted average.
This eliminates soft-float library calls on platforms without FPU
(e.g., ESP8266), reducing the function from 352 bytes.
The integer version uses uint16_t weighted average which matches
the float version's output in 99.96% of cases (off-by-one in
the remaining 0.04% due to float precision differences).
Zephyr's k_uptime_get() returns int64_t milliseconds directly,
eliminating the need for 32-bit rollover tracking on this platform.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Zephyr's k_uptime_get() returns int64_t milliseconds directly,
eliminating the need for 32-bit rollover tracking on this platform.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
All listener notifications (connect_state, disconnect, got_ip,
scan_complete) are now deferred to wifi_loop_() via pending_ flags.
The TODO was completed but the comment was never removed.
The host platform already uses clock_gettime(CLOCK_MONOTONIC) for
millis(). Use it directly for millis_64() instead of delegating to
the Scheduler's rollover tracking.
This eliminates the MULTI_ATOMICS rollover code path (CAS/atomic)
on host builds and removes the dependency on App.scheduler for
millis_64() to work.
The fully-qualified friend uint64_t ::esphome::millis_64() syntax
causes 'uint64_t is not a class, namespace, or enumeration' errors
on the ESP8266 clang-tidy toolchain. Use unqualified form which
resolves correctly within the esphome namespace.
The fully-qualified friend uint64_t ::esphome::millis_64() syntax
causes 'uint64_t is not a class, namespace, or enumeration' errors
on ESP8266 clang-tidy. Use unqualified form which resolves correctly
within the esphome namespace.