Commit Graph
28444 Commits
Author SHA1 Message Date
J. Nick Koston 4e560dbd2e Merge remote-tracking branch 'upstream/dev' into integration 2026-04-30 21:11:33 -05:00
luar123 f6e39d305d [zigbee] Add newlib compatibility for zigbee sdk in idf 6 (#16174) 2026-04-30 22:08:55 -04:00
Jonathan Swoboda 08e5cb5576 [esp32_hosted] Bump esp_hosted to 2.12.6 and esp_wifi_remote to 1.5.1 (#16176) 2026-04-30 20:47:22 -05:00
Kevin Ahrendt faa61696e0 [sendspin] Use sendspin-cpp to v0.4.0 to reduce stuttering (#16178) 2026-04-30 20:43:24 -05:00
J. Nick Koston 9999913d07 [zephyr] Move HAL bodies into components/zephyr/hal.cpp + inline trivial dispatches (#16116) 2026-04-30 20:10:51 -05:00
J. Nick Koston 92aa98f680 [host] Move HAL bodies into components/host/hal.cpp + inline trivial dispatches (#16115) 2026-05-01 00:42:38 +00:00
J. Nick Koston 3d69169141 [climate] Fold ControlAction fields into a single stateless lambda (#16044) 2026-04-30 19:16:16 -05:00
J. Nick Koston 24fdfcf1a1 [rp2040] Move HAL bodies into components/rp2040/hal.cpp + inline trivial dispatches (#16114) 2026-04-30 19:15:41 -05:00
J. Nick Koston 550444dc34 [binary_sensor] Drop Component from filter classes, use self-keyed scheduler (#16131) 2026-04-30 19:15:18 -05:00
J. Nick Koston ba7c06785a [mdns] Broadcast config_hash TXT record on _esphomelib._tcp (#16145) 2026-04-30 19:14:55 -05:00
J. Nick Koston b708d1a826 [core] Drop unused DELAY_ACTION from InternalSchedulerID enum (#16151) 2026-04-30 19:14:34 -05:00
J. Nick Koston 148d478dec [api] Add encode/decode benchmarks for Z-Wave, IR/RF, and serial proxy messages (#16157) 2026-04-30 19:14:20 -05:00
J. Nick Koston 45e78e4114 [core] Inline loop gate expression to avoid stale local reuse (#16167) 2026-04-30 19:13:54 -05:00
J. Nick Koston 3b3e003aa3 [sensor] Pack ThrottleAverageFilter have_nan_ into n_ bitfield (-4 B/instance) (#16169) 2026-04-30 19:13:10 -05:00
J. Nick Koston 2f3e16b482 [bk72xx] Apply CFG_SUPPORT_BLE=0 SDK option to BK7238 (#16181) 2026-04-30 19:12:06 -05:00
J. Nick Koston e085cb50d9 [sensor] Drop Component from filter classes, use self-keyed scheduler (#16132) 2026-04-30 19:11:30 -05:00
J. Nick Koston 2fbfb4c385 [ci] Split integration tests into 3 buckets when count is more than 10 (#16152) 2026-04-30 19:10:53 -05:00
J. Nick Koston 61261b4a59 [libretiny] Move HAL bodies into components/libretiny/hal.cpp + inline trivial dispatches (#16113) 2026-04-30 12:33:22 -05:00
J. Nick Koston d48aad8c4d [esp32] Replace 512B stack buffer in printf wraps with picolibc cookie FILE (#16170) 2026-04-30 13:27:54 -04:00
J. Nick Koston 1baee65d85 Merge remote-tracking branch 'upstream-ssh/scheduler-pool-unbounded-freelist' into integration 2026-04-30 12:03:29 -05:00
J. Nick Koston 0651a905bc [core] Avoid std::bad_array_new_length pull in shrink_scheduler_vector_
The classic std::vector swap-with-copy idiom (vector<T>(other).swap(other))
instantiates the iterator-range copy constructor, which pulls in
std::__throw_bad_array_new_length and the related typeinfo + vtable + dtor +
what() method (~118 B of stdlib RTTI). Build into a temp via reserve +
push_back instead, then move-assign:

- reserve uses ::operator new (throws bad_alloc, already linked).
- push_back without growth is the noexcept tail path.
- move-assign just swaps pointers, no allocation.

Same shrink semantics, saves ~128 B flash on ESP32. Also adds a fast-path
early return for the case where capacity already equals size (common after
a quiet period, since vector capacity only grows when crossing the doubling
threshold).
2026-04-30 12:02:55 -05:00
J. Nick Koston 27d7b2caec [core] Drop static on shrink_scheduler_vector_ for clang-tidy compliance
Project's .clang-tidy applies different naming rules to static methods
(ClassMethodCase, no suffix) vs instance methods (PrivateMethodCase /
ProtectedMethodCase, _ suffix required). The helper had a trailing _ but
was static, so clang-tidy flagged it. Drop static -- the helper is already
noinline'd and called only at trim time, so the hidden this arg is free
in any meaningful sense.
2026-04-30 11:58:52 -05:00
J. Nick Koston ce116a69e7 [core] Drop static on shrink_scheduler_vector_ for clang-tidy compliance
Project's .clang-tidy applies different naming rules to static methods
(ClassMethodCase, no suffix) vs instance methods (PrivateMethodCase /
ProtectedMethodCase, _ suffix required). The helper had a trailing _ but
was static, so clang-tidy flagged it. Drop static -- the helper is already
noinline'd and called only at trim time, so the hidden this arg is free
in any meaningful sense.
2026-04-30 11:58:44 -05:00
J. Nick Koston 0fcbc442fe Merge remote-tracking branch 'upstream-ssh/scheduler-pool-unbounded-freelist' into integration 2026-04-30 11:38:57 -05:00
J. Nick Koston d7594db6fd [core] Factor trim_freelist() vector shrink into out-of-line helper
The three swap-with-copy lines in trim_freelist() inlined the
construct-swap-destruct dance per call site, costing ~440 B flash on ESP32.
Move the swap-shrink into a noinline private static helper so all three
callers share one body. Net flash cost of vector shrinking drops to ~296 B
(from ~444 B) while preserving the same RAM-reclaim behaviour.

shrink_to_fit() is a non-binding hint that the toolchain ignores, so the
swap-with-copy idiom is still required.
2026-04-30 11:38:17 -05:00
J. Nick Koston 56e1ceda33 Merge remote-tracking branch 'upstream-ssh/scheduler-pool-unbounded-freelist' into integration 2026-04-30 11:31:34 -05:00
J. Nick Koston 8b840e8517 [core] Also shrink items_/to_add_/defer_queue_ vector capacity in trim_freelist()
The freelist holds the boot-peak count of recycled SchedulerItem*; items_,
to_add_, and defer_queue_ hold the boot-peak vector *capacity* of live
SchedulerItem*. std::vector grows by doubling and retains capacity even when
items drain, so post-boot the vector slack can be larger than the freelist
itself. Swap each with a same-content copy to size them exactly to their
current contents.

Live items are preserved -- the swap-copy idiom builds the new vector from
the existing pointers, then the old (over-capacity) vector is destroyed.
2026-04-30 11:31:13 -05:00
J. Nick Koston d36c56d3f5 [core] Trim scheduler freelist of post-boot peak 10s after setup
Boot churn (component init, first sensor reads, retries) inflates the freelist
beyond the steady-state high-water mark. Without a one-shot trim that peak
would be retained forever. Adds Scheduler::trim_freelist() and schedules it
from Application::setup() to fire SCHEDULER_FREELIST_TRIM_DELAY_MS (10s) after
setup completes -- well past the bulk of post-setup async work.

Items currently in items_/to_add_/defer_queue_ are untouched; only the
freelist's recycled items are deleted. Post-trim, the freelist regrows to
the new (post-startup) high-water mark.
2026-04-30 11:29:32 -05:00
J. Nick Koston e9bd84cb43 Revert "[sensor] Drop Component from timeout filters, use self-keyed scheduler"
This reverts commit 6ccc2b23b5.
2026-04-30 11:15:10 -05:00
J. Nick Koston 7d529bff12 Revert "[sensor] Drop incorrect O(1) complexity claim from timeout filter comment"
This reverts commit 87a2b623f3.
2026-04-30 11:15:09 -05:00
J. Nick Koston 633a1112d1 Merge remote-tracking branch 'upstream-ssh/sensor-timeout-filter-scheduler' into integration 2026-04-30 11:06:59 -05:00
J. Nick Koston 20743e3e9a Merge branch 'scheduler-pool-unbounded-freelist' into integration 2026-04-30 11:06:46 -05:00
Kevin Ahrendt f1d3be4bda [core] Simplify RAMAllocator and add internal fallback to external mode (#16171) 2026-04-30 12:03:40 -04:00
J. Nick Koston 87a2b623f3 [sensor] Drop incorrect O(1) complexity claim from timeout filter comment
set_timer_common_'s self-key cancel path scans items_ and to_add_ linearly,
so the cancel-and-replace is O(N) in the global scheduler item count, not
O(1). Reword to describe the behavior without the complexity claim.

Address Copilot review feedback.
2026-04-30 11:01:24 -05:00
J. Nick Koston 2a451cb870 [core] Strengthen scheduler-pool integration test with lower-bound check
Adds an assertion that the observed peak pool size exceeds the old
MAX_POOL_SIZE=5 cap. Without this, a silent regression that re-introduced a
small cap could pass the existing pool_full_count == 0 invariant. Phase 5 + 6
of the fixture schedule 8 + 10 same-component timeouts, so the peak should
comfortably exceed 5.

Address Copilot review feedback on PR.
2026-04-30 10:57:11 -05:00
J. Nick Koston 6ccc2b23b5 [sensor] Drop Component from timeout filters, use self-keyed scheduler
Migrates TimeoutFilterBase / TimeoutFilterLast / TimeoutFilterConfigured off
Component, mirroring the migration #16132 did for the other Component-based
sensor filters. They now arm/re-arm via App.scheduler.set_timeout(this, ...)
keyed on the filter pointer; the scheduler cancels and replaces any pending
arm in O(1) on each new_value(). Filters live for the program's lifetime, so
the self-key never dangles.

Net effect: this reverts the design from #11922, which moved timeout filters
off the scheduler specifically because the bounded SchedulerItem pool churned
on devices with many timers (LD2450 etc.). With #16172 replacing that pool
with an unbounded intrusive freelist, the original churn problem is gone and
the scheduler is once again the right primitive for this workload.

Per-instance footprint shrinks: lose Component (second vptr, packed bookkeeping
bytes, ComponentRuntimeStats block when runtime_stats: is enabled) and drop
the now-unused timeout_start_time_ field. get_setup_priority() and the loop()
poll go with it.

Sensor timeout-filter syntax is unchanged. No user-facing change.
2026-04-30 10:49:18 -05:00
J. Nick Koston f9b87d0ede [core] Replace scheduler pool vector with unbounded intrusive freelist
The fixed MAX_POOL_SIZE=5 cap was the source of the heap churn the pool was
meant to prevent: any device with more than 5 concurrent timers (e.g. a board
with 30+ LD2450 sensors) hit a steady-state oscillation of recycle->delete and
acquire->new on every loop iteration.

Replace std::vector<SchedulerItem*> with a singly-linked freelist threaded
through SchedulerItem::next_free, which shares storage with `component` via an
anonymous union (zero per-item overhead -- the component pointer is dead while
pooled). Drop the cap entirely: the freelist quiesces at the application's
natural concurrent-timer high-water mark, which is the working set the device
already needs while those timers are active.

No std::vector means no growth-doubling slack and no realloc copies during
warm-up. Caller of get_item_from_pool_locked_() must overwrite item->component
before unlocking (already true at the sole call site); nullptr remains a valid
live `component` value for SELF_POINTER items, so we cannot pre-clear it.
2026-04-30 10:42:46 -05:00
J. Nick Koston db5040a468 Merge remote-tracking branch 'upstream/dev' into integration 2026-04-30 10:17:42 -05:00
J. Nick Koston e32ce0f006 Merge remote-tracking branch 'upstream/sensor-throttle-average-pack-bitfield' into integration 2026-04-30 08:15:59 -05:00
Kevin Ahrendt 2758aa5517 [audio] bump microOpus to v0.4.0 to use fixed-point by default on ESP32 (#16168) 2026-04-30 09:12:39 -04:00
J. Nick Koston bf917144c4 [sensor] Pack ThrottleAverageFilter have_nan_ into n_ bitfield
Saves 4 B per ThrottleAverageFilter instance (28 B → 24 B on 32-bit).
have_nan_ is a single boolean that previously cost 4 B due to padding;
fold it into the high bit of n_ as a 31-bit + 1-bit bitfield.

To guarantee n_ cannot overflow under realistic configurations, cap
the YAML time_period at 24 h. At a pessimistic 1 kHz source rate the
counter peaks at 86.4M, leaving 25x headroom against 2^31. Anyone
needing multi-day rolling averages should be using a different
filtering strategy anyway.

Breaking change: configurations with throttle_average periods longer
than 24 h will now fail validation. No real-world configs are
expected to use such values.
2026-04-30 08:11:31 -05:00
J. Nick Koston d05f4f82e1 Merge remote-tracking branch 'upstream/core-loop-wake-take-first' into integration 2026-04-30 07:52:35 -05:00
Kevin Ahrendt a8b0133ec1 [audio] Enable specific codecs and configure advanced features (#16166) 2026-04-30 08:49:28 -04:00
J. Nick Koston 59a8057e9a [core] Inline loop gate expression to avoid stale local reuse
The previous gate captured each subexpression in a named local
(high_frequency, elapsed, woke). Locals are easy to reuse later in
the function, and we have hit bugs from stale reuse before — most
recently is_high_frequency being read again instead of re-checked.
Inline the expression directly into do_component_phase so there is
nothing tempting to reuse downstream.
2026-04-30 06:34:14 -05:00
J. Nick Koston d403f472fc Merge remote-tracking branch 'upstream/api-infrared-rf-speed-optimized' into integration 2026-04-30 06:22:15 -05:00
Clyde Stubbs 1398dcebb4 [st7789v] Add deprecation warnings (#16162) 2026-04-30 00:53:37 -05:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 096d0c4279 Bump aioesphomeapi from 44.22.0 to 44.23.0 (#16161)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-30 04:45:19 +00:00
Jesse Hills e127268dac [core] Strip \\?\ prefix from sys.executable for PlatformIO subprocess (#16158) 2026-04-30 16:04:52 +12:00
J. Nick Koston 27116e1239 Merge remote-tracking branch 'origin/followup/hal-libretiny' into integration 2026-04-29 22:50:45 -05:00
J. Nick Koston 6097d5d7f8 Merge branch 'dev' into followup/hal-libretiny
# Conflicts:
#	esphome/core/hal/hal_libretiny.h
2026-04-29 22:43:47 -05:00