Commit Graph
25134 Commits
Author SHA1 Message Date
J. Nick Koston 0959c35753 Merge remote-tracking branch 'upstream/float-to-raw-optimization' into integration 2026-03-18 10:30:22 -10:00
J. Nick Koston 85be827bb0 Use union instead of memcpy in float_to_raw — xtensa-gcc doesn't optimize memcpy in all contexts 2026-03-18 10:16:37 -10:00
J. Nick Koston e7d1d08fa1 Use memcpy instead of __builtin_bit_cast for ESP8266 compat 2026-03-18 10:12:04 -10:00
J. Nick Koston 856a0b0c83 [api] Use integer comparison for float zero checks in protobuf encoding
Replace floating-point comparison (value != 0.0f) with integer bit-pattern
check via a shared float_to_raw() helper in both encode_float() and
calc_float(). This avoids software float library calls on platforms without
hardware FPU (ESP8266, some LibreTiny chips) and ensures both functions
use identical zero-check logic so size calculation always matches encoding.
2026-03-18 10:04:59 -10:00
J. Nick Koston 80192ad0d0 Merge remote-tracking branch 'upstream/remove-call-loop-wrapper' into integration 2026-03-18 09:58:33 -10:00
J. Nick Koston 810f2f4b0d Remove call_loop_ wrapper and call loop() directly 2026-03-18 09:50:22 -10:00
Jonathan Swoboda 47909d5299 [hub75] Bump esp-hub75 to 0.3.5 (#14915) 2026-03-18 09:47:14 -10:00
J. Nick Koston d5731b3700 Merge remote-tracking branch 'upstream/dev' into integration 2026-03-18 09:45:16 -10:00
J. Nick Koston fc03e7d2cd Merge remote-tracking branch 'upstream/callback-drop-captures' into integration 2026-03-18 09:44:58 -10:00
dependabot[bot] 16667bf5be Bump aioesphomeapi from 44.5.2 to 44.6.0 (#14927)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-18 09:39:26 -10:00
dependabot[bot] ef3afe3e21 Bump codecov/codecov-action from 5.5.2 to 5.5.3 (#14928)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-18 09:33:29 -10:00
dependabot[bot] 3a47317fc8 Bump actions/cache from 5.0.3 to 5.0.4 in /.github/actions/restore-python (#14930)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-18 09:33:15 -10:00
dependabot[bot] 89066e3e20 Bump actions/cache from 5.0.3 to 5.0.4 (#14929)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-18 09:33:00 -10:00
J. Nick Koston 33e646cedf [core] Store parent pointer as member to enable inline Callback storage
Callback::create() can store callables inline (no heap allocation)
when they fit in sizeof(void*) — i.e., a single [this] capture on
32-bit platforms. Many automation triggers captured [this, parent]
in their callback lambdas, doubling the capture size and forcing
heap allocation.

Store the parent/state pointer as a class member and capture only
[this] in the lambda. This trades 4 bytes of member storage for
avoiding a permanent heap allocation per callback registration.

Components changed: cover, valve, lock, fan, media_player, datetime,
display_menu_base, graphical_display_menu, esp32_improv, mqtt_fan.
2026-03-18 09:05:18 -10:00
J. Nick Koston 9a80c980cb [scheduler] Early exit cancel path after first match (#14902) 2026-03-18 07:48:26 -10:00
J. Nick Koston c9e6c85e6a [scheduler] Inline fast-path checks into header (#14905) 2026-03-18 07:48:11 -10:00
J. Nick Koston e88c9ba066 [core] Inline progmem_read functions on non-ESP8266 platforms (#14913) 2026-03-18 07:47:42 -10:00
J. Nick Koston 45be290392 [ci] Bump Python to 3.14 in sync-device-classes workflow (#14912) 2026-03-18 07:47:17 -10:00
J. Nick Koston 3f28ab88ca [http_request] Fix data race on update_info_ strings in update task (#14909) 2026-03-18 07:46:18 -10:00
Jonathan Swoboda 1d07f37d62 [opentherm] Migrate from legacy timer API to GPTimer API (#14859) 2026-03-18 09:22:28 -04:00
Jonathan Swoboda 16c5224341 [tc74][apds9960] Fix signed temperature and FIFO register address (#14907) 2026-03-18 07:48:43 -04:00
J. Nick Koston 8120fce094 Merge remote-tracking branch 'upstream/fix-http-request-update-double-launch-v2' into integration 2026-03-17 19:57:26 -10:00
J. Nick Koston a4eaa53c64 Merge branch 'fix-http-request-update-string-race' into fix-http-request-update-double-launch-v2 2026-03-17 19:23:05 -10:00
J. Nick Koston e436265d6c [http_request] Prevent double update task launch
Guard against launching a second FreeRTOS update task while one is
already running. Without this, calling update() twice (e.g. from both
the polling interval and the initial check interval) could spawn two
concurrent tasks both writing to the same UpdateInfo.

With the single-defer structure from the race fix PR, clearing the
handle only needs to happen in one place — at the top of the deferred
lambda, before any other work.
2026-03-17 19:21:15 -10:00
J. Nick Koston 7eea0653dc Merge branch 'dev' into fix-http-request-update-string-race 2026-03-17 19:00:58 -10:00
J. Nick Koston 7b04f4ea8b [http_request] Soften SBO comment to say supported toolchains 2026-03-17 18:51:12 -10:00
J. Nick Koston fd70517445 [http_request] Use file-local TaskResult instead of modifying UpdateInfo
Address review feedback:
- Move error_str out of public UpdateInfo into file-local TaskResult
- Add container.reset() before vTaskDelete (doesn't call destructors)
- Remove redundant has_progress/progress assignments after move
- Add comment on delete after std::move
2026-03-17 18:39:01 -10:00
J. Nick Koston 17476934c8 [http_request] Guard against empty firmware_url before path merge
Accessing path[0] on an empty string is undefined behavior.
Add an empty check before the relative URL merge logic.
2026-03-17 18:34:24 -10:00
J. Nick Koston 564128127b [http_request] Call container->end() on non-OK status, fix comment
Address Copilot review feedback:
- Call container->end() when status_code != HTTP_STATUS_OK (pre-existing
  bug, but easy to fix while we're here)
- Update error_str comment to say "update check failure" not "fetch failure"
2026-03-17 18:33:55 -10:00
J. Nick Koston e93e064304 [http_request] Inline apply_manifest_result_main_loop_ into defer lambda
One less method — the logic lives directly in the lambda body.
No flash change (compiler was already inlining the call).
2026-03-17 18:27:53 -10:00
J. Nick Koston 211273d46c [http_request] Inline fetch_manifest_ back into update_task
Eliminates separate function call overhead — compiler can optimize
across the single function. Saves ~32 bytes flash on ESP8266.
2026-03-17 18:26:22 -10:00
J. Nick Koston f496936b31 [http_request] Reduce flash cost of update race fix
- Move state computation to main loop callback (avoids 2 extra lambda captures)
- Add error_str field to UpdateInfo so error info rides with the pointer
- Allocate UpdateInfo once at top of fetch_manifest_ (single ownership path)
- Lambda captures only 2 pointers (8 bytes), fits std::function SBO

Reduces ESP8266 flash delta from +480 to ~+288 bytes.
2026-03-17 18:23:51 -10:00
J. Nick Koston a28a6f7d93 [http_request] Fix data race on update_info_ strings in update task
The update task runs in a FreeRTOS thread on ESP32 and was writing
directly to update_info_ std::string fields while the main loop
reads them via API (as StringRef pointers into the string buffer),
MQTT, web server, and Prometheus. This is undefined behavior that
can cause use-after-free crashes when a string reallocation
invalidates a StringRef held by the API serialization path.

Move all update_info_ and state_ writes into the existing defer()
callback so they execute on the main loop. The task now accumulates
results in a local UpdateInfo struct and moves it into update_info_
in the deferred callback, eliminating the cross-thread data race
with zero steady-state memory overhead.
2026-03-17 17:58:10 -10:00
Jesse Hills e83372e2f3 Merge branch 'beta' into dev 2026-03-18 16:22:02 +13:00
Jesse Hills 6b9be033d6 Merge pull request #14904 from esphome/bump-2026.3.0b4
2026.3.0b4
2026.3.0b4
2026-03-18 16:21:28 +13:00
Jonathan Swoboda 2531fb1a02 [voice_assistant][micro_wake_word] Fix null deref and missing error return (#14906) 2026-03-17 23:12:13 -04:00
J. Nick Koston e79a4d6d2d Merge branch 'scheduler-cancel-early-exit' into integration 2026-03-17 16:41:30 -10:00
J. Nick Koston 112ea15509 Merge branch 'inline-scheduler-cleanup-fast-path' into integration 2026-03-17 16:41:25 -10:00
J. Nick Koston dd200c0522 [scheduler] Inline fast paths for cleanup_(), process_to_add(), and process_defer_queue_()
Move the fast-path checks from cleanup_(), process_to_add(), and
process_defer_queue_() into inline methods in the header. The common
case — nothing to clean up, nothing to add, nothing deferred — now
resolves with just an atomic load at the call site, avoiding a function
call into the .cpp translation unit entirely.

The slow paths remain in scheduler.cpp as cleanup_slow_path_(),
process_to_add_slow_path_(), and process_defer_queue_slow_path_().

Also moves the process_defer_queue_() body out of the header into
the .cpp file, reducing code bloat in every translation unit that
includes scheduler.h.
2026-03-17 16:40:26 -10:00
J. Nick Koston 2c01f961c6 [scheduler] Early exit cancel path in set_timer_common_ and fix benchmark
Add find_first parameter to cancel_item_locked_ and
mark_matching_items_removed_locked_, defaulting to false (cancel all).

When find_first=true, stops after the first match and exits across
containers. set_timer_common_ passes find_first=true where the
cancel-before-add invariant guarantees at most one match.

The public cancel path uses the default find_first=false to cancel ALL
matches, needed for DelayAction parallel mode where skip_cancel=true
can create multiple items with the same key.

Also fixes the Scheduler_SetInterval benchmark to call
process_to_add() every kKeyCount registrations with a final drain
after the inner loop, reflecting production behavior.
2026-03-17 16:34:32 -10:00
J. Nick Koston 3e845d387a [tests] Fix test_show_logs_serial taking 30s due to unmocked serial port wait (#14903) 2026-03-17 14:44:17 -10:00
Jesse Hills 5cc03d9bef Bump version to 2026.3.0b4 2026-03-18 13:35:21 +13:00
0fa96b6e1e [scheduler] Fix UB in cross-thread counter/vector reads, add atomic fast-path (#14880)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2026-03-18 13:35:21 +13:00
J. Nick KostonandJesse Hills be2e4a5278 [mqtt] Fix data race on inbound event queue (#14891)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2026-03-18 13:35:21 +13:00
J. Nick Koston 80bd6489cf [esp32_ble_server] Remove vestigial semaphore from BLECharacteristic (#14900) 2026-03-18 13:35:21 +13:00
J. Nick Koston ccf672d7ee [esp32_ble] Fix EventPool/LockFreeQueue sizing off-by-one (#14892) 2026-03-18 13:35:20 +13:00
J. Nick Koston 6154b673c2 [usb_uart] Fix EventPool/LockFreeQueue sizing off-by-one (#14895) 2026-03-18 13:35:20 +13:00
J. Nick Koston 3bde7ec978 [usb_host] Fix EventPool/LockFreeQueue sizing off-by-one (#14896) 2026-03-18 13:35:20 +13:00
J. Nick Koston 8caa11dcf4 [usb_cdc_acm] Fix EventPool/LockFreeQueue sizing off-by-one (#14894) 2026-03-18 13:35:20 +13:00
J. Nick Koston 1b70df2c1f [espnow] Fix EventPool/LockFreeQueue sizing off-by-one (#14893) 2026-03-18 13:35:20 +13:00