Repository navigation
Keep firmware autonomous during host UART loss - #585
Merged
Merged
Conversation
DRSDavidSoft
enabled auto-merge
October 1, 2026 17:40
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The bounded receive loop addresses UART starvation while retaining framing behavior and targeted regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Bounds UART receive work to keep firmware services responsive during noisy or failed host connections.
Changes:
- Limits each UART service pass to 32 bytes and handles failed reads.
- Preserves incremental frame parsing across service calls.
- Adds regression coverage for noise, read failures, and recovery.
| File | Description |
|---|---|
Project/UartProtocol.cpp |
Implements bounded, failure-aware UART reads. |
Project/UartProtocol.h |
Defines the receive-byte budget. |
Tools/VirtualBoard/tests/uart_protocol_test.cpp |
Tests bounded processing and recovery. |
Tools/VirtualBoard/tests/arduino_mock/Arduino.h |
Adds simulated serial read failures. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Closes #584.
Root cause
The firmware UART service had drained
HardwareSerialuntilavailable()reached zero since the initial firmware commit. A removed or noisy USB-UART bridge can keep adding input, monopolizing the MCU loop and starving autonomous keys, relays, displays, LEDs, audio, telemetry, and completion of the watchdog-supervised loop.Fix
Verification
No Go build/test was run in this pass.