Commit Graph
11 Commits
Author SHA1 Message Date
J. Nick Koston 6a0e5ffce8 [ld2420] Address fourth review round
Sync new_config with current_config on the give-up path and gate the
config writing actions on an explicit config read complete flag so a
partial read can never be written to the module's NVM, raise the retry
listen window above the module boot silence, treat replies shorter
than the expected data length as silence, apply the parser mode only
after the mode write is acknowledged, propagate write errors in the
apply and factory reset actions before adopting the new config or
clearing the warning, log drain failures and unbuildable startup
frames, watch the runtime marked as failed log string in the tests,
give the first enable command in the retry fixture genuine silence,
and alternate the warm restart stream values so state deduplication
cannot starve a late subscriber.
2026-08-16 21:59:17 -05:00
J. Nick Koston 713b3b2bc9 [ld2420] Simplify after review rounds
Model the listen settle window as its own state instead of two flags,
pass reception into the state machine as a parameter instead of the
rx_seen_ member, consolidate the duplicated button action guards into
a shared precondition helper, extract the give-up path from the retry
ladder, batch the receive drain reads, rename the command attempt
counter, and deduplicate the newest integration tests with a shared
log watcher and subscription helpers.
2026-08-16 21:13:54 -05:00
J. Nick Koston d6179b6d56 [ld2420] Address third review round
Guarantee a drain pass in every listen phase so bytes that arrived
before it can never satisfy the settle window even when the main loop
stalls, publish the number entities on the give-up path, zero the
reply data before each startup send so short acks cannot store stale
values, zero initialize the config threshold arrays, refuse config
writes when the configuration was never read, guard the revert button
during startup, gate the apply and factory reset warning clear on the
final ack, report the firmware version as unknown in dump_config until
it is read, and add tests for the command resend and the sequence
retry and give-up paths.
2026-08-16 21:12:58 -05:00
J. Nick Koston 73a95c411d [ld2420] Add module restart regression test
Presses the restart button while the module is mid transmission: the
in-flight frame tail bytes arriving right after the restart command
must not count as proof the module is up, and the setup handshake must
only run again after the module's first post-boot frame.
2026-08-16 21:12:58 -05:00
J. Nick Koston de7af3865b [ld2420] Address second review round
Ignore reception during a settle window at the start of each listen
phase so in-flight bytes from a restarting module cannot count as
proof it is up, drain stale replies before each startup send so acks
cannot be matched to the wrong command, always send the blind config
mode exit when abandoning a sequence, log module error replies and an
unknown firmware version on the give-up path, skip transmitting for
states with no command frame, and clear the warning status when a
later apply or factory reset succeeds. Fixture timings adjusted for
the settle window.
2026-08-16 21:12:58 -05:00
J. Nick Koston 338e498960 [ld2420] Address review findings
Clear cmd_active_ when the blocking engine exhausts retries so loop()
does not stay skipped forever, send config mode exit blind before
abandoning a startup sequence so the module resumes streaming, and
repeat the first frame in the delayed boot fixture so the initial
state swallow cannot make the test flaky.
2026-08-16 21:12:58 -05:00
J. Nick Koston 15e1ac2500 [ld2420] Simplify startup state machine and tests
Rebuild startup frames on demand instead of keeping a frame member,
share the ack timeout and retry constants with the blocking engine,
guard the restart button during startup, drop dead code, and factor
the duplicated integration test bodies into a shared helper.
2026-08-16 21:12:58 -05:00
J. Nick Koston 3402ee8bb1 [ld2420] Wait for data from the module before configuring it
The LD2420 locks up until power cycled if it receives any data before
it has sent its first frame after powering on. Setup previously
transmitted immediately, blocking for up to 3 seconds and marking the
component failed on the first timeout. Setup is now a non blocking
state machine that listens for the module before transmitting, retries
the handshake, and degrades to a warning instead of failing.
2026-08-16 21:12:58 -05:00
J. Nick Koston 61d2632851 [ld2420] Extract command frame builders from the blocking senders
Behavior free refactor: split the frame serialization out of
send_cmd_from_array, split the frame construction out of the blocking
command functions into build helpers, name the ack timeout and retry
constants, remove the unused CmdFrameT length field and the unused
get_reg_value_ method. No functional change.
2026-08-16 21:12:28 -05:00
J. Nick Koston e9d940aca4 [ld2420] Drop the setup priority override so setup runs after the UART bus
The component declared setup_priority::BUS, the same tier as the UART
bus itself. At a tie the setup order falls back to registration order,
so on ESP-IDF the component could run setup before uart_driver_install
and the failed write marked the UART bus failed for the whole boot.
Delete the override so the component uses the default DATA priority
like ld2410 and ld2450.
2026-08-16 21:00:05 -05:00
J. Nick KostonandJesse Hills 1b5bf2c848 [wifi] Revert cyw43_wifi_link_status change for RP2040
The switch from cyw43_tcpip_link_status to cyw43_wifi_link_status
was intended for 2026.3.0 alongside the arduino-pico 5.5.0 framework
update but was accidentally included in 2026.2.3.

With the old framework (3.9.4), cyw43_wifi_link_status never returns
CYW43_LINK_UP, so the CONNECTED state is unreachable. The device
connects to WiFi but the status stays at CONNECTING until timeout,
causing a connect/disconnect loop.

Fixes https://github.com/esphome/esphome/issues/14422
2026-03-03 20:46:31 +13:00