Commit Graph

28149 Commits

Author SHA1 Message Date
J. Nick Koston 0f69504dd0 Revert "[bk72xx] Add BK7238 boards in preparation for upstream support"
This reverts commit 1a0642546b.
2026-04-27 09:30:07 -05:00
J. Nick Koston 4cd3431884 Merge remote-tracking branch 'origin/wifi_phy_mode_esp8266' into integration 2026-04-27 08:08:53 -05:00
J. Nick Koston 16bc151758 [wifi] Log phy_mode in dump_config 2026-04-27 08:01:30 -05:00
J. Nick Koston 191115bf18 Merge remote-tracking branch 'origin/ota-wakeable-delay-yield' into integration 2026-04-27 07:55:22 -05:00
J. Nick Koston 465e34be39 Merge remote-tracking branch 'origin/ota-data-loop-timeout' into integration 2026-04-27 07:54:59 -05:00
J. Nick Koston ee0da8a482 Merge remote-tracking branch 'origin/wifi_phy_mode_esp8266' into integration 2026-04-27 07:50:19 -05:00
J. Nick Koston 4f4ad64f19 [wifi] Add explicit AUTO option to phy_mode 2026-04-27 07:49:29 -05:00
J. Nick Koston e232325a33 [wifi] Add phy_mode option for ESP8266 2026-04-27 07:43:21 -05:00
Kevin Ahrendt 24c6a0d711 [audio] Bump microDecoder library to v0.2.0 (#16054) 2026-04-27 12:17:02 +00:00
plazarre dec5d0449b [esp32_ble_tracker] Hold COEX_PREFER_BT for the lifetime of any active connection (#16036)
Co-authored-by: Paul Lazarre <plazarre@gmail.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2026-04-27 06:51:54 -05:00
J. Nick Koston 3c9b42a43f Merge branch 'fix-coex-revert-during-active-connection' into integration 2026-04-27 06:46:49 -05:00
J. Nick Koston 24a0db1029 Merge remote-tracking branch 'origin/test-cover-control-action' into integration 2026-04-27 06:46:18 -05:00
J. Nick Koston 5f15dc9ba4 Merge remote-tracking branch 'origin/test-climate-control-action' into integration 2026-04-27 06:46:14 -05:00
J. Nick Koston d26e29d89c Merge remote-tracking branch 'origin/light-toggle-action-constexpr-template' into integration 2026-04-27 06:46:06 -05:00
J. Nick Koston 4ed7956094 Merge remote-tracking branch 'origin/light-dim-relative-constexpr-template' into integration 2026-04-27 06:46:00 -05:00
J. Nick Koston 26e8fcbfa9 Merge remote-tracking branch 'origin/inline-continuation-actions' into integration 2026-04-27 06:45:52 -05:00
J. Nick Koston 1135eeaf99 Merge remote-tracking branch 'origin/cover-action-bitmask' into integration 2026-04-27 06:45:48 -05:00
J. Nick Koston c3a830cebd Merge remote-tracking branch 'origin/api-connection-incomplete-type' into integration 2026-04-27 06:45:38 -05:00
J. Nick Koston a46d7e0a6a [cover] Also exercise cover.template.publish with state: alias 2026-04-27 06:42:15 -05:00
J. Nick Koston c60cf7f5b7 [climate] Add climate.control coverage to component tests via thermostat 2026-04-27 06:21:56 -05:00
J. Nick Koston 50b0474d60 [cover] Reword: generic coverage, not bitmask-specific 2026-04-27 06:20:43 -05:00
J. Nick Koston 53454adc40 [cover] Add cover.control / cover.template.publish coverage to template tests 2026-04-27 06:19:39 -05:00
J. Nick Koston acc15ff495 [api] Use custom deleter to fix incomplete-type error on macOS libc++
libc++ eagerly instantiates the unique_ptr<APIConnection> destructor
when std::array<std::unique_ptr<APIConnection>, N> is parsed, requiring
sizeof(APIConnection). api_server.h only forward-declares APIConnection
(via list_entities.h), so the destructor instantiation fails for any
translation unit that includes api_server.h without also including
api_connection.h first.

Wrap the unique_ptr in a custom deleter (APIConnectionDeleter) whose
operator() is defined out-of-line in api_server.cpp where APIConnection
is complete. The default_delete<APIConnection> path is never
instantiated, so libc++'s incomplete-type assertion is avoided.

GCC/libstdc++ already deferred this instantiation, so this only affects
macOS host-platform builds (used by integration tests).
2026-04-27 05:59:21 -05:00
J. Nick Koston 801cfe621b [ota] Fix clang-tidy goto-jumps-init and set error_code on timeout
Address two issues on the new data-loop timeout:

- clang-tidy ESP32 Arduino flagged "cannot jump from this goto statement to its label" at the existing pre-loop `goto error` sites because the new `uint32_t last_data_ms = millis();` declaration sat between them and the `error:` label, so the jumps would skip past its initialization. Move the declaration up next to the other handle_data_ locals (`total`, `last_progress`) and just assign it before the loop entry. The earlier gotos no longer cross an init.

- Copilot pointed out the new timeout `goto error` left `error_code` at `OTA_RESPONSE_OK` (set by `backend_->begin()`), so the device would write OK back to the uploader even though it was aborting. Set `error_code = ota::OTA_RESPONSE_ERROR_UNKNOWN` before the goto so the uploader receives a correct failure code.
2026-04-27 05:54:32 -05:00
J. Nick Koston 6770a6b87f [cover] Address Copilot review on integration test fixture and macro comments 2026-04-27 05:39:21 -05:00
J. Nick Koston fbafade78c [ota] Add wall-clock timeout to OTA data transfer loop
The main `while (total < ota_size)` loop in `ESPHomeOTAComponent::handle_data_()`
had a `// TODO: timeout check` and no wall-clock guard. If the uploader
side dropped the TCP connection without a FIN/RST being delivered to
the device (uploader process killed mid-transfer, NAT/router state
dropped, packet loss eating the RST), `recv_fn` would never see a
close and `s_err_fn` would never fire, so:

- `pcb_` stays non-null
- `rx_closed_` stays false
- `waiting_for_data_()` stays true forever
- the loop spins on `EWOULDBLOCK`, fed by `App.feed_wdt(); continue;`,
  indefinitely

LwIP TCP keepalive is not enabled on the OTA socket, and even when
enabled the default keepalive timer is on the order of hours, so the
device is effectively unresponsive until power cycle. This matches
the "device unresponsive until I do a hard power-reset" symptom in
issue #15953.

Track the timestamp of the last successful read and abort if no data
arrives for `OTA_SOCKET_TIMEOUT_DATA` (90s, same constant the handshake,
`readall_()`, and `writeall_()` already use). The timeout resets on
every successful read so a slow but live link does not false-trigger.
2026-04-27 05:29:40 -05:00
J. Nick Koston 1ab588f10e [core] Drop redundant inline_continuation test (covered by test_continuation_actions) 2026-04-27 05:11:11 -05:00
J. Nick Koston 65b5615a31 [light] Use InitialStateHelper in DimRelativeAction integration test 2026-04-27 05:10:02 -05:00
J. Nick Koston 83f83c96a8 [light] Use InitialStateHelper in ToggleAction integration test 2026-04-27 05:09:27 -05:00
J. Nick Koston a532f0adc9 [cover] Use InitialStateHelper in integration test 2026-04-27 05:08:08 -05:00
J. Nick Koston 23e64de392 [core] Add integration test for inline ContinuationAction 2026-04-27 05:07:14 -05:00
J. Nick Koston 2eac9f5121 [light] Add integration test for DimRelativeAction 2026-04-27 05:05:00 -05:00
J. Nick Koston e9ced485ea [light] Add integration test for ToggleAction 2026-04-27 05:04:28 -05:00
J. Nick Koston 3522eef8ee [cover] Add integration test for ControlAction/CoverPublishAction 2026-04-27 05:02:58 -05:00
J. Nick Koston feaa903056 [cover] Use bitmask template parameter for ControlAction/CoverPublishAction
Apply the bitmask pattern from LightControlAction (#16039) to
cover::ControlAction (3 fields: stop, position, tilt) and
cover::CoverPublishAction (3 fields: position, tilt, current_operation).
Unused fields are elided via [[no_unique_address]] and skipped at
compile time in play() via if constexpr.

Codegen for cover.control: and cover.template.publish: builds the
bitmask from the YAML keys present. CONF_STATE and CONF_POSITION
both map to the same position bit (they are mutually exclusive YAML
keys for the same C++ field).

Per-instance: 16-28 B depending on which fields are set, down from
~28 B baseline.
2026-04-27 04:58:35 -05:00
J. Nick Koston c30aa4aad4 [core] wakeable_delay: yield on already-woken fast path (ESP8266, RP2040)
When `g_main_loop_woke` is already set on entry to `wakeable_delay()`,
both the ESP8266 and RP2040 paths consume the flag and return without
yielding. That's safe in isolation, but if a caller loops on
`wakeable_delay()` (e.g. `LWIPRawImpl::wait_for_data_()` waiting for
SO_RCVTIMEO), and ISR sources (GPIO, timer, WiFi RX on ESP8266; alarm
/ async on RP2040) keep re-setting the flag between iterations, every
iteration takes the fast path and the loop never yields.

That can starve the SDK / async context, blocking actual TCP delivery
to our socket and causing OTA reads to time out on busy devices even
though there is data in flight. The PR that introduced
`wait_for_data_()` (#14675) relied on `wakeable_delay()` to yield on
every iteration; this restores that property on the fast path.

Adds `delay(0)` on ESP8266 and `yield()` on RP2040 to the fast path,
matching the yield behaviour those platforms already use for the
`ms == 0` poll case.
2026-04-27 04:55:43 -05:00
J. Nick Koston 35f043d671 Merge branch 'inline-continuation-actions' into integration 2026-04-26 22:51:19 -05:00
J. Nick Koston 83d879265e [core] Document add_then/add_else single-call precondition 2026-04-26 22:32:58 -05:00
J. Nick Koston e85de4d34a [core] Document add_then/add_else single-call precondition 2026-04-26 22:32:26 -05:00
J. Nick Koston 35163e5bca Merge branch 'inline-continuation-actions' into integration 2026-04-26 22:22:06 -05:00
J. Nick Koston f40eb9b780 [core] Inline ContinuationAction in IfAction/WhileAction/RepeatAction
Replace heap-allocated ContinuationAction/WhileLoopContinuation/
RepeatLoopContinuation instances with inline members, eliminating one
heap allocation per IfAction/WhileAction/RepeatAction at setup.

Each parent already needs exactly one continuation as the chain
terminator that hands control back. Heap-allocating it costs the
~16-byte object plus an ~8-byte heap header per instance, plus heap
fragmentation. Inlining moves the same 16 bytes from heap to BSS
and drops the heap header overhead.

Per-parent net change:
- BSS: +16 B (the inline continuation; +32 B for IfAction<true>)
- Heap: -24 B per heap allocation eliminated (16 B object + ~8 B header)
- Net RAM saved: ~8 B per simple parent, ~16 B for IfAction<true>
- Plus: one fewer heap allocation per parent at setup, less fragmentation

For IfAction<HasElse=false>, the else continuation is elided via
[[no_unique_address]] + an empty wrapper struct, so it costs 0 B.

Note: CI memory analysis only measures static RAM (BSS), not heap.
This change moves bytes from heap to BSS, so the report will show
BSS increasing while the actual heap savings (and fragmentation
reduction) are not directly visible.
2026-04-26 22:17:26 -05:00
J. Nick Koston 79b741b8dc [core] Combine entity register + configure_entity_ into one call (#16030) 2026-04-27 03:03:39 +00:00
tomaszduda23 112646a9c4 [zigbee] add router for nrf52 (#16034) 2026-04-26 23:02:09 -04:00
J. Nick Koston 63e7e70d18 Merge remote-tracking branch 'upstream-ssh/light-control-action-bitmask' into integration 2026-04-26 21:55:05 -05:00
J. Nick Koston 9a468eef8c [light] Undef LIGHT_CONTROL_FIELDS macro and assert <=16 fields 2026-04-26 21:54:33 -05:00
J. Nick Koston 2e096bb036 [core] Combine set_component_source_ + register_component_ into one call (#16029) 2026-04-26 21:54:15 -05:00
J. Nick Koston ad9f21cf04 Merge remote-tracking branch 'upstream-ssh/light-control-action-bitmask' into integration 2026-04-26 21:53:27 -05:00
J. Nick Koston 13250897ad [light] Add dim_relative test case with transition_length 2026-04-26 21:47:52 -05:00
J. Nick Koston dae15301e1 [light] Shorten Empty<Tag> comment to one line 2026-04-26 21:41:24 -05:00
J. Nick Koston 9f776eb517 [light] Shorten FIELDS comment 2026-04-26 21:40:52 -05:00