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.
millis() on the line above casts esp_timer_get_time() to uint32_t.
Match that pattern in millis_64() with static_cast<uint64_t> to
avoid implicit signed-to-unsigned conversion.
- Use 1000ULL divisor in millis_64() to match millis() style and
avoid implicit signed-to-unsigned conversion
- Clarify next_schedule_in @param: now is unused for 64-bit
extension on ESP32, but still used for 32-bit paths in call()
- Remove unnecessary uint64_t cast on esp_timer_get_time() (already
returns int64_t, always non-negative after boot)
- Fix next_schedule_in @param comment: now is only unused on ESP32,
used for rollover tracking on other platforms
- Use fully-qualified friend declaration (::esphome::millis_64())
- Remove unnecessary uint64_t cast on esp_timer_get_time() (already
returns int64_t, always non-negative after boot)
- Fix next_schedule_in @param comment: now is only unused on ESP32,
used for rollover tracking on other platforms
- Use fully-qualified friend declaration (::esphome::millis_64())
Include hal.h directly in scheduler.h instead of forward-declaring
millis_64(), which clang-tidy flags as redundant when both headers
are included in the same translation unit.
On ESP32, millis() truncates esp_timer_get_time() to 32-bit, then
Scheduler::millis_64_() reconstructs 64-bit using 193 bytes of
CAS/atomic/lock rollover tracking code. This is unnecessary since
esp_timer_get_time() already provides native 64-bit microseconds.
Add millis_64() as a HAL-level function alongside millis():
- ESP32: native esp_timer_get_time()/1000 (26 bytes, lock-free)
- Other platforms: delegate to Scheduler::millis_64_impl_() which
retains the existing rollover tracking (renamed from millis_64_)
Saves 344 bytes flash and ~8 bytes RAM on ESP32 by eliminating the
rollover tracking code and associated atomic fields. External callers
(uptime, web_server) now use millis_64() directly instead of
App.scheduler.millis_64().
Restore the cyw43_wifi_set_up() call for STA mode that was incorrectly
removed. Without this, cyw43_wifi_scan() fails on initial boot because
the radio isn't initialized - scanning must work before the first
beginNoBlock() call.
Call cyw43_arch_enable_sta_mode() in wifi_mode_() when STA is requested.
Without this, cyw43_wifi_scan() fails on initial boot because the radio
isn't initialized yet - it only got enabled later inside beginNoBlock().
This caused the state machine to skip scanning, fall through to
RETRY_HIDDEN, and do a wasteful blind SSID-only connect for non-hidden
networks.
The cyw43_ev_scan_result_t ssid field is a 32-byte buffer that is
not guaranteed to be null-terminated. Use ssid_len to properly
terminate the string before passing it to string comparison functions.
This fixes false "should be marked hidden" warnings where the SSID
match failed due to garbage bytes after the actual SSID in the buffer.
Update the RP2040 Arduino-Pico framework to 5.5.0 (from 3.9.4) and
the platform to v1.4.0-gcc14-arduinopico460 (GCC 14 toolchain).
Breaking changes adapted:
- pico-sdk 2.0: padsbank0_hw renamed to pads_bank0_hw
- Arduino.h now defines NOPIN as a global macro (SerialPIO::NOPIN removed)
- WiFi: cyw43_tcpip_link_status() no longer works because the Arduino
framework's __wrap_cyw43_cb_tcpip_init is a no-op (the SDK's internal
netif is never initialized). Switched to cyw43_wifi_link_status() for
radio state + WiFi.status()/WiFi.connected() for IP-level state.
- WiFi: Use beginNoBlock() instead of begin() to avoid 20s+ blocking
- WiFi: Use WiFi.disconnect() for proper lwIP/DHCP cleanup