fix(firmware): phantom LD2410 detection + ENOMEM backoff (#1135)#1159
Merged
Conversation
Bug #2 (root cause): LD2410 probe-detection matched only the 4-byte head 0xF4F3F2F1, so a floating UART at 256000 baud could phantom-detect a sensor and spawn a UART task. Now requires a full validated report frame (head + sane length + tail 0xF8F7F6F5), extracted to mmwave_detect.h and shared with a host unit test (test_mmwave_detect.c, 8 vectors) so firmware and test can't diverge. Matches the validate-before-trust approach used for MR60 in #1107. Bug #1: sendto ENOMEM used a fixed 100 ms backoff too short to drain sustained lwIP/WiFi buffer pressure, so a node could stay stuck. Now exponential (100->200->...->2000 ms per consecutive ENOMEM, reset on first successful send). Removing the phantom LD2410 task (bug #2) also removes the extra load that tipped the reporter's tier-2 node into the stuck state. Validated on ESP32-S3 QFN56 rev v0.2 (the reporter's silicon): tier-2 streams ~100 frames/s with no stuck ENOMEM and correctly reports no mmWave (no phantom). LD2410 predicate truth table proven (head-without-tail REJECTED). Could not reproduce the reporter's environment-specific floating-pin noise, so the deterministic proof is the host unit test. Co-Authored-By: claude-flow <ruv@ruv.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1135 (against the v0.8.1-esp32 release).
Bug #2 — phantom LD2410 on a floating UART (root cause)
LD2410 probe-detection matched only the 4-byte head
0xF4F3F2F1, so floating-pin noise at 256000 baud could phantom-detect a sensor and spawn a UART task. Now requires a full validated report frame — head + sane intra-frame length + matching tail0xF8F7F6F5— the same validate-before-trust approach used for MR60BHA2 in #1107. Extracted tommwave_detect.hand shared with a host unit test so firmware and test can't diverge.Bug #1 — sendto ENOMEM stuck loop
Fixed 100 ms backoff was too short to drain sustained lwIP/WiFi buffer pressure. Now exponential (100→200→…→2000 ms per consecutive ENOMEM, reset on first successful send). Eliminating the phantom LD2410 task (bug #2) also removes the extra load that tipped the reporter's tier-2 node into the stuck state.
Validation
test_mmwave_detect.c, 8 vectors) — tests the real predicate; the stream_sender: sendto ENOMEM in a tight loop on ESP32-S3 (v0.8.1-esp32) — 0 UDP frames ever leave the node #1135 case (head magic without valid tail) is REJECTED. Wired into the Makefile +host_tests(runs gcc in CI). Compiles clean against the header; truth table proven.🤖 Generated with claude-flow