Commit Graph
26792 Commits
Author SHA1 Message Date
J. Nick Koston d82cc0c08a [api] Guard benchmark friend declarations with USE_BENCHMARK 2026-04-01 09:43:47 -10:00
J. Nick Koston 34cbe0abe1 [api] Fix stale comment: 1MB → 16MB socket buffers 2026-04-01 09:40:25 -10:00
J. Nick Koston 9fb8594a16 [api] Fix lint false positive on 'byte' in comment 2026-04-01 09:06:07 -10:00
J. Nick Koston c09d5d783c [api] Fix immediate benchmark to set batch_delay=0
should_send_immediately_ requires both should_try_send_immediately
flag AND batch_delay==0. Without setting batch_delay to 0, all
sends were falling back to the batch path.
2026-04-01 09:00:59 -10:00
J. Nick Koston d717c7b46c [api] Use large socket buffers and remove mid-loop draining
Increase socket buffer to 16MB so benchmarks never hit WOULD_BLOCK
during an inner loop iteration. Remove per-iteration drain_socket
calls that were adding noise and causing the immediate path to
fall back to batching. Drain only between outer iterations.
2026-04-01 08:54:30 -10:00
J. Nick Koston f469a7ced2 [api] Add process_batch benchmarks for single and multi-sensor
Add ProcessBatch_SingleSensor and ProcessBatch_5Sensors benchmarks
that measure the full batch processing path: queue → process_batch_ →
dispatch → encode → frame → TCP write.
2026-04-01 08:49:33 -10:00
J. Nick Koston 3a4a88df29 [api] Add warm batch benchmark and bench_clear_batch friend
Add SendSensorState_Batch_Warm that pre-warms the deferred batch vector
before benchmarking to isolate steady-state cost from allocation.
2026-04-01 08:43:38 -10:00
J. Nick Koston d3f3f89c59 [api] Extract shared TCP loopback helper for API benchmarks
Deduplicate the TCP loopback socket setup between bench_plaintext_frame
and bench_send_sensor_state into a shared bench_helpers.h header.
2026-04-01 07:48:12 -10:00
J. Nick Koston dcac526a34 [api] Add send_sensor_state benchmarks
Add benchmarks for the full send_sensor_state path covering both
immediate send and batch paths. This measures the end-to-end cost
of sending a sensor state update through an APIConnection including
entity field population, proto encode, framing, and TCP write.
2026-04-01 07:42:58 -10:00
J. Nick Koston 12ab72fb21 Merge remote-tracking branch 'upstream/dev' into integration 2026-04-01 07:13:34 -10:00
Jonathan Swoboda 2e3ea2152d [esp32_camera] Bump esp32-camera to v2.1.6 (#15349) 2026-04-01 07:13:23 -10:00
J. Nick Koston 87a0d0d858 Merge remote-tracking branch 'upstream/dev' into integration 2026-04-01 07:12:13 -10:00
J. Nick Koston ea609d3552 [runtime_stats] Store stats inline on Component to eliminate std::map lookup (#15345) 2026-04-01 07:09:04 -10:00
f33fd047ee [hdc2080] Add support for HDC2080 sensor (#9331)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Co-authored-by: Big Mike <mikelawrence@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-04-01 12:09:22 -04:00
cc88896280 [debug] add peripherals status (#12053)
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-04-01 15:04:22 +00:00
J. Nick Koston bac0a23f20 Merge branch 'bluetooth-proxy-set-interval' into integration 2026-04-01 00:35:00 -10:00
J. Nick Koston 7ac7155c74 Merge remote-tracking branch 'upstream/runtime-stats-inline-recording' into integration 2026-04-01 00:32:06 -10:00
J. Nick Koston a9e81e6c42 Remove unnecessary nullptr guard — component is never null 2026-04-01 00:31:31 -10:00
J. Nick Koston 9f92df69f8 Fix clang-tidy: single-pass collection, add NOLINT for global 2026-04-01 00:29:54 -10:00
J. Nick Koston 1020f68188 Add nullptr guard in record_runtime_stats_ for scheduler items 2026-04-01 00:29:18 -10:00
J. Nick Koston c5623f5175 [bluetooth_proxy] Replace loop() with set_interval for advertisement flushing
bluetooth_proxy's loop() ran every main loop iteration (~7400 times/60s)
but only flushed advertisements every 100ms (~600 times/60s). The remaining
~6800 iterations just checked a timestamp and returned, wasting loop
framework overhead.

Replace with set_interval(100ms) so the component only runs when there's
work to do. Move flush_pending_advertisements to an inline method in the
header to avoid out-of-line call overhead in the hot parse_devices path.
Remove redundant is_connected/api_connection checks from flush since all
callers already guard.
2026-04-01 00:26:33 -10:00
J. Nick Koston 843b1c052a Merge remote-tracking branch 'upstream/libretiny-wifi-queue-abstraction' into integration 2026-03-31 23:25:15 -10:00
J. Nick Koston 08ed0840ca Merge branch 'runtime-stats-inline-recording' into integration 2026-03-31 23:21:07 -10:00
J. Nick Koston 0daa0fb29d Fix clang-tidy: remove trailing underscore from static methods 2026-03-31 23:17:18 -10:00
J. Nick Koston 695b41763a Add WarnIfComponentBlockingGuard as friend for runtime_stats_ access 2026-03-31 23:12:42 -10:00
J. Nick Koston 0b59acb922 Fix access: use friend + static comparators for protected member access 2026-03-31 23:11:33 -10:00
J. Nick Koston b63dc719e5 Fix protected access: move ComponentRuntimeStats before Component class 2026-03-31 23:08:23 -10:00
J. Nick Koston bd4bc24bcc Merge branch 'dev' into runtime-stats-inline-recording 2026-03-31 23:00:30 -10:00
J. Nick Koston d1ef6bf604 [runtime_stats] Store stats inline on Component to eliminate std::map lookup
The runtime_stats component used a std::map<Component*, ComponentRuntimeStats>
to record per-component timing data. Every loop iteration for every component
required a red-black tree lookup to record its time, adding ~2-3µs of
measurement overhead per component — often exceeding the actual work done
by lightweight components like OTA idle checks.

Move RuntimeStats struct directly onto Component (behind #ifdef USE_RUNTIME_STATS)
so recording is a direct member access with zero lookup cost. The
RuntimeStatsCollector now iterates App.components_ to collect stats instead of
maintaining its own map, eliminating ~2KB of red-black tree code.
2026-03-31 22:58:18 -10:00
Edward Firmoandpre-commit-ci-lite[bot] fbfb5d401f [nextion] Fix memory leak in reset_() (#15344)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2026-03-31 22:34:29 -10:00
J. Nick Koston 249a4bdcf0 Add configASSERT checks for pvPortMalloc failures
Matches ESP-IDF's assert pattern for the static allocation callbacks.
2026-03-31 22:27:19 -10:00
J. Nick Koston b726d108f8 Only enable configSUPPORT_STATIC_ALLOCATION on BK72xx
RTL87xx loses 280 bytes heap with it enabled. BK72xx gains 712 bytes.
Keep it BK72xx-only where it's a clear win.
2026-03-31 22:06:35 -10:00
J. Nick Koston 08eccb081c Revert "Revert: only enable configSUPPORT_STATIC_ALLOCATION on BK72xx"
This reverts commit 444ee47ecb.
2026-03-31 22:04:44 -10:00
J. Nick Koston 444ee47ecb Revert: only enable configSUPPORT_STATIC_ALLOCATION on BK72xx
RTL87xx loses 472 bytes heap with it enabled due to different FreeRTOS
internals. BK72xx gains 712 bytes, so keep it there only.
2026-03-31 22:04:14 -10:00
J. Nick Koston bdb9618938 Enable configSUPPORT_STATIC_ALLOCATION for all LibreTiny platforms
The FreeRTOS timer command queue moves from heap to BSS on all
LibreTiny targets, not just BK72xx. RTL87xx and LN882x benefit
from the same heap savings.
2026-03-31 22:00:22 -10:00
J. Nick Koston d3545c960f Document intentional no-destructor and fast-path read rationale 2026-03-31 21:45:15 -10:00
J. Nick Koston 6e9ebf6b1b Fix scoping: declare count outside portENTER_CRITICAL block
BK72xx portENTER_CRITICAL expands to something that introduces a
scope, so variables declared between ENTER/EXIT are not visible after.
2026-03-31 21:43:21 -10:00
J. Nick Koston b980978f05 Enable configSUPPORT_STATIC_ALLOCATION on BK72xx
Add build flag and required callbacks (following ESP-IDF's pvPortMalloc
approach) so FreeRTOSQueue can use xQueueCreateStatic — queue storage
lives in BSS with zero runtime heap allocation.
2026-03-31 21:42:59 -10:00
J. Nick Koston b829bbee95 Use increment_dropped_count() internally in push() 2026-03-31 21:33:57 -10:00
J. Nick Koston 1e156d46b6 Fast path for get_and_reset_dropped_count to avoid critical section
Plain read of aligned uint16_t is safe on ARM. Since drops are rare,
almost every call returns 0 without entering a critical section.
2026-03-31 21:32:26 -10:00
J. Nick Koston bb2991bfda Address review: critical sections for dropped_count_, delete copy/move
- Protect dropped_count_ increment and get+reset with
  portENTER_CRITICAL/portEXIT_CRITICAL since std::atomic is unavailable
  on NO_ATOMICS platforms
- Delete copy/move constructors and assignment operators
- Remove volatile qualifier (critical sections provide proper
  synchronization)
2026-03-31 21:31:41 -10:00
J. Nick Koston 4f33faf89d Restore nullptr checks for xQueueCreate failure 2026-03-31 20:48:33 -10:00
J. Nick Koston 586e37c864 Use xQueueCreate — BK72xx FreeRTOS lacks static allocation
BK72xx's FreeRTOS does not enable configSUPPORT_STATIC_ALLOCATION,
so xQueueCreateStatic is unavailable. Fall back to xQueueCreate
which is a one-time heap allocation during setup.
2026-03-31 20:47:47 -10:00
J. Nick Koston 948449502f Guard freertos_queue.h with ESPHOME_THREAD_MULTI_NO_ATOMICS
Prevents compilation failure on host/native builds where FreeRTOS
headers are not available.
2026-03-31 20:44:43 -10:00
J. Nick Koston 9db5c8ac2d Use xQueueCreateStatic to avoid heap allocation
Storage buffer and control block are now class members, matching
LockFreeQueue's static buffer approach. Removes all null handle checks.
2026-03-31 20:42:13 -10:00
J. Nick Koston 42c2f1906f Use constexpr for queue size with +1 for LockFreeQueue ring buffer 2026-03-31 20:39:43 -10:00
J. Nick Koston 8b81cf3fda [wifi] Use queue abstraction for LibreTiny WiFi events
Replace static FreeRTOS queue globals in the LibreTiny WiFi component
with the same queue abstraction used by ESP32:

- ESPHOME_THREAD_MULTI_ATOMICS (RTL87xx, LN882x): LockFreeQueue
- ESPHOME_THREAD_MULTI_NO_ATOMICS (BK72xx): new FreeRTOSQueue wrapper

Add FreeRTOSQueue in freertos_queue.h — an xQueue wrapper providing
the same API as LockFreeQueue (push, pop, get_and_reset_dropped_count)
for platforms without hardware atomic instructions.

The event queue is now a class member instead of a static global,
matching the ESP32 pattern.
2026-03-31 20:39:21 -10:00
J. Nick Koston 24f916ba67 merge 2026-03-31 20:15:57 -10:00
J. Nick Koston 6f4f852d8e Merge remote-tracking branch 'upstream/dev' into integration 2026-03-31 20:15:36 -10:00
Rene GucaandRene 212b3e1688 [cover] move time_based_cover to its own subdirectory (#15313)
Co-authored-by: Rene <rene@guca.at>
2026-03-31 21:59:24 -04:00