Commit Graph
27833 Commits
Author SHA1 Message Date
J. Nick Koston 2a0f2abd6b Merge remote-tracking branch 'origin/core-application-stale-includes' into integration 2026-04-23 05:57:27 -05:00
J. Nick Koston 64ca25ec84 Merge remote-tracking branch 'origin/scheduler-volatile-counters' into integration 2026-04-23 05:57:17 -05:00
J. Nick Koston 4ec2e42d4d [scheduler] Rename counter mutators with _locked_ suffix
Rename the seven counter RMW mutators to carry the `_locked_` suffix
that matches the existing convention (pop_raw_locked_,
is_item_removed_locked_, cancel_item_locked_, etc.):

  to_add_count_increment_   -> to_add_count_increment_locked_
  to_add_count_clear_       -> to_add_count_clear_locked_
  defer_count_increment_    -> defer_count_increment_locked_
  defer_count_clear_        -> defer_count_clear_locked_
  to_remove_add_            -> to_remove_add_locked_
  to_remove_decrement_      -> to_remove_decrement_locked_
  to_remove_clear_          -> to_remove_clear_locked_

The caller-must-hold-lock contract became load-bearing when the
underlying counters became volatile on NO_ATOMICS: ++/+=/-- compile to
a three-instruction LDR/OP/STR sequence that is not atomic against a
concurrent RMW from another task, so the lock is what keeps the
counter consistent. The new suffix makes the requirement explicit at
every call site, matching how the rest of the scheduler documents the
same invariant.

No behavioural change; all call sites already hold lock_.
2026-04-23 05:49:49 -05:00
J. Nick Koston c414cc393f [scheduler] Enable lock-free fast-path on ESPHOME_THREAD_MULTI_NO_ATOMICS
The _empty_() helpers (to_add_empty_, defer_empty_, to_remove_empty_)
forced the lock path on ESPHOME_THREAD_MULTI_NO_ATOMICS by hardcoding
`return false`. That made Scheduler::call() pay a FreeRTOS mutex
round-trip for each of process_defer_queue_ / process_to_add /
cleanup_ on every idle tick just to confirm "nothing to do".

On the only NO_ATOMICS target (BK72xx — ARMv5TE, single-core), an
aligned 32-bit load is atomic at the hardware level. Mark the three
skip-work counters volatile so the compiler cannot cache or elide the
read, and let _empty_() compare against zero directly. Writers still
hold lock_ for any RMW — that invariant is unchanged.

A stale 0 is benign: the counter is checked on every Scheduler::call()
iteration, so a missed update is caught next tick. Same pattern as the
NO_ATOMICS reads in time_64.cpp.

On BK72xx at ~3100 iter/min with ~8us/mutex this reclaims roughly
75ms/min of main-loop overhead. Measured on BK7238/BK7231N while
profiling alongside libretiny-eu/libretiny#360.

ATOMICS and SINGLE paths are unchanged (SINGLE keeps plain uint32_t,
no volatile-read overhead).
2026-04-23 05:47:52 -05:00
J. Nick Koston 8da2b8225a [core] Inline yield_with_select_ as direct wakeable_delay call
yield_with_select_ was a trivial one-line passthrough to
esphome::internal::wakeable_delay(). Remove the wrapper and call
wakeable_delay() directly at the two call sites.
2026-04-23 05:14:25 -05:00
J. Nick Koston 8fe40f33a6 [core] Drop unused lwip_fast_select.h include from application.h
No symbols from lwip_fast_select.h are referenced in application.h.
2026-04-23 05:13:12 -05:00
J. Nick Koston 14bd2f5a52 [core] Remove stale includes from application.cpp
socket.h is unused after #15931 moved the host wake mechanism to
wake.cpp. lwip_fast_select.h is already included via application.h
under the same guard.
2026-04-23 05:12:12 -05:00
J. Nick Koston 3b212b9944 [core] Add permalink to BDK sctrl_dpll_delay200us in WDT interval comment
So future readers can verify the errata claim without chasing the PR.
2026-04-23 04:47:52 -05:00
J. Nick Koston 72d4efb681 Merge remote-tracking branch 'upstream/bk72xx-wdt-feed-interval' into integration 2026-04-23 04:45:51 -05:00
J. Nick Koston c7fdd534bc [core] Raise WDT_FEED_INTERVAL_MS to 2000ms on BK72xx
BK72xx silicon requires a ~200us busy-wait (sctrl_dpll_delay200us) between
two watchdog register key writes on every reload, making each
arch_feed_wdt() call ~300us on BK7231T/N/BK7238. This is hardware errata
in the BDK's wdt_ctrl (beken378/driver/wdt/wdt.c:WCMD_RELOAD_PERIOD) and
cannot be worked around at the SDK level.

LibreTiny initialises the BK72xx HW watchdog at 10000ms, but ESPHome's
generic WDT_FEED_INTERVAL_MS of 300ms was sized for ESP8266's 1.6s soft
watchdog. That left BK72xx over-servicing the watchdog ~33x per timeout
window, paying ~60ms/min of main-loop overhead to no benefit.

Raise the interval to 2000ms on BK72xx only, which keeps a 5x safety
margin on the 10s HW WDT — matching the ESP8266 ratio that originally
motivated the 300ms value — while cutting feed frequency ~6x.

Measured on a NiceMCU XH-WB3S (BK7238) while testing
libretiny-eu/libretiny#360:

  Before (300ms interval):
    wdt_slow_path: hits=195 (5.9% of iters, avg=315.97us/hit)
    main_loop_before_breakdown: sched=73.2ms, wdt=61.6ms, residual=0.0ms

Other platforms retain the existing 300ms value.
2026-04-23 04:44:05 -05:00
J. Nick Koston b47a7e65a8 Merge remote-tracking branch 'upstream/wifi-bdk-bk7238-typedef-conflict' into integration 2026-04-23 04:25:52 -05:00
J. Nick Koston b4206f94bc [wifi] Avoid BDK 3.0.78 wifi_event_sta_disconnected_t collision on BK72xx
BDK 3.0.78 (required by LibreTiny for BK7238 support, see
libretiny-eu/libretiny#360) declares wifi_event_sta_disconnected_t in
wlan_defs_pub.h, which collides with the identically named typedef in
LibreTiny's Arduino WiFi API (WiFiEvents.h). Rename the BDK version
across the include so both headers can coexist. ESPHome only uses
bk_wlan_get_link_status from this header and doesn't reference the
renamed type.

The rename is a no-op on BDK 3.0.33 (BK7231T/N) since that version
doesn't declare the typedef.
2026-04-23 04:22:16 -05:00
PolarGoose 43a371caab [dsmr] Small refactoring: Move Aes128GcmDecryptorImpl type inside esphome::dsmr namespace. (#15940) 2026-04-23 04:08:49 -05:00
J. Nick Koston 6b0c510376 Merge remote-tracking branch 'origin/api-logger-plaintext-fallback' into integration 2026-04-23 04:05:55 -05:00
J. Nick Koston db06ae7952 Merge remote-tracking branch 'upstream/dev' into integration 2026-04-23 04:05:38 -05:00
J. Nick Koston e16566e4af [api] Fall back to plaintext for logger connections 2026-04-23 03:32:33 -05:00
dependabot[bot] 64290d32a1 Bump aioesphomeapi from 44.20.0 to 44.21.0 (#15941)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-23 03:32:12 -05:00
J. Nick Koston 9685d4eb0b [core] feed_wdt wraps feed_wdt_with_time (#15932) 2026-04-23 01:15:44 -05:00
Keith Burzinski 4c2efd4165 [radio_frequency] Add experimental radio_frequency entity type (base component + API) (#15556) 2026-04-23 01:15:25 -05:00
J. Nick Koston 6f00ea1457 [core] Move host socket-select wake mechanism into wake.h/wake.cpp (#15931) 2026-04-23 15:53:10 +12:00
J. Nick Koston bb3ad6e431 Merge remote-tracking branch 'upstream/dev' into integration 2026-04-22 22:32:06 -05:00
Jonathan Swoboda a881121110 [ota] Make set_auth_password() lambda-callable via empty-password opt-in (#15928) 2026-04-22 23:06:31 -04:00
dependabot[bot] f8167c9a70 Bump aioesphomeapi from 44.19.0 to 44.20.0 (#15936)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-23 02:40:19 +00:00
Jesse Hills e1d629f0d2 [time] Handle Windows EINVAL when validating POSIX TZ strings (#15934) 2026-04-23 14:35:13 +12:00
Clyde Stubbs 224cc7b419 [lvgl] Triggers on tabview tabs fix (#15935) 2026-04-23 14:35:00 +12:00
Jesse Hills 4d4347d33a Merge branch 'release' into dev 2026-04-23 14:10:54 +12:00
Jesse Hills 6ca5b31fab Merge pull request #15933 from esphome/bump-2026.4.2
2026.4.2
2026.4.2
2026-04-23 14:10:10 +12:00
dependabot[bot] 17f9269841 Update wheel requirement from <0.47,>=0.43 to >=0.43,<0.48 (#15926)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-22 19:12:15 -05:00
dependabot[bot] 6253947311 Bump click from 8.3.2 to 8.3.3 (#15927)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-22 19:12:02 -05:00
J. Nick Koston 92afd391b4 Merge remote-tracking branch 'upstream/feed-wdt-wrap' into integration 2026-04-22 18:37:47 -05:00
J. Nick Koston 74abd1cee5 [core] feed_wdt wraps feed_wdt_with_time 2026-04-22 18:37:00 -05:00
J. Nick Koston da65516e26 Merge remote-tracking branch 'origin/core-host-wake-into-wake-files' into integration 2026-04-22 18:33:09 -05:00
J. Nick Koston b8165a0ad9 Merge remote-tracking branch 'upstream/dev' into integration 2026-04-22 18:33:03 -05:00
Jesse Hills 00b71208a6 Bump version to 2026.4.2 2026-04-23 11:18:39 +12:00
Keith Burzinski 76eb8f697f [usb_uart] Derive TX output chunk count from buffer_size config (#15909) 2026-04-23 11:18:39 +12:00
Jonathan Swoboda 2a3bd8bc85 [io_expanders] Self-heal interrupt-driven expanders when INT stays asserted across the read (#15923) 2026-04-23 11:18:39 +12:00
Keith Burzinski 629da4d878 [esp32] Add Secure Boot V1 ECDSA signing scheme for pre-rev-3.0 ESP32 (#15882) 2026-04-23 11:18:39 +12:00
Jonathan Swoboda 5c2ceb63e0 [ld2412] Fix null deref in set_basic_config when entities unconfigured (#15893) 2026-04-23 11:18:39 +12:00
Jonathan Swoboda 92cb6dd7fd [core] Fix Pvariable placement new losing subclass identity (#15881) 2026-04-23 11:18:39 +12:00
Jonathan Swoboda 06e5931ad7 [image] Fix rodata bloat for multi-frame RGB565+alpha animations (#15873) 2026-04-23 11:18:39 +12:00
Clyde Stubbs dc5b06285d [lvgl] Fix update of textarea attached to keyboard (#15866) 2026-04-23 11:18:38 +12:00
Clyde Stubbs 3d0a2421a6 [lvgl] Fix overloads for setting images on styles (#15864) 2026-04-23 11:18:38 +12:00
Clyde Stubbs 22f6791dea [lvgl] Fix format of hello world page (#15868) 2026-04-23 11:18:38 +12:00
Keith Burzinski 70b1d9a087 [api_protobuf] Support compound ifdef conditions in proto generator (#15930) 2026-04-22 17:57:15 -05:00
J. Nick Koston ab8af7f736 [core] Force inline host wake_fd_ready() and wake_drain_notifications() 2026-04-23 00:52:18 +02:00
J. Nick Koston ec833ce2d9 [core] Move host socket-select wake mechanism into wake.h/wake.cpp
The host platform's wake plumbing was split between wake.cpp (which had
wake_loop_threadsafe()) and application.{h,cpp} (which owned the fd
registry, wake socket lifecycle, select() loop, and readiness query).
The split required application.h to friend wake_loop_threadsafe() and
expose the wake socket fd, and forced a host-only out-of-line override
of yield_with_select_() that was equivalent to wakeable_delay() on every
other platform.

Consolidate the host wake mechanism in wake.h/wake.cpp:

- New host-only API: wake_register_fd, wake_unregister_fd, wake_fd_ready,
  wake_setup, wake_drain_notifications.
- Host implementation of internal::wakeable_delay now performs the
  select() over registered fds, mirroring the role of xTaskNotifyTake on
  ESP32 and esp_delay on ESP8266.
- Application drops the host-specific socket_fds_, max_fd_,
  wake_socket_fd_, socket_fds_changed_, read_fds_, base_read_fds_
  members, the host include block (sys/select.h, sys/socket.h, etc.),
  and the friend declarations for wake_loop_threadsafe() and
  socket::socket_ready_fd().
- yield_with_select_() collapses to a single inline definition for all
  platforms that delegates to wakeable_delay().
- Socket factories (bsd_sockets_impl.cpp, lwip_sockets_impl.cpp) and
  socket::socket_ready_fd() now call the wake.h API directly instead of
  going through App.
2026-04-23 00:33:04 +02:00
Keith Burzinski 36720c8495 [usb_uart] Derive TX output chunk count from buffer_size config (#15909) 2026-04-23 09:16:14 +12:00
Jonathan Swoboda c48ab2ef92 [io_expanders] Self-heal interrupt-driven expanders when INT stays asserted across the read (#15923) 2026-04-23 09:05:15 +12:00
Keith Burzinski 162ee2ecaf [i2s_audio] Split speaker into base class and standard subclass (#15404) 2026-04-22 14:40:18 -05:00
Asela FernandoandJonathan Swoboda a73bac0b5f [ac_dimmer] Zero-crossing interrupt type (#15862)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-04-22 14:57:53 -04:00