retain telemetry across transport outages

This commit is contained in:
Jay
2026-08-17 14:00:14 -04:00
parent bc4a2856e1
commit 291c6b54e6
11 changed files with 222 additions and 37 deletions
@@ -11,6 +11,8 @@ data.
- Host compilation of the production C encoder with `-Wall -Wextra -Werror`
- Fragmented C-encoder-to-Python-parser contract test
- Deliberately corrupted CRC test with stream resynchronization
- Full eight-record, timestamp-saturation, invalid-size/count, and truncated-tail
encoder/parser contract cases
- ESP-IDF firmware build and flash on the assembled ESP32-C3 prototype
- Live USB capture followed by independent offline re-decoding
@@ -55,3 +57,26 @@ at priority 5 and receives samples through a 512-entry queue (about 5.12 seconds
at 100 Hz). The hardware capture's zero timing anomalies and zero loop overruns
confirm that packet encoding, CRC, float metadata, and USB output did not disturb
the acquisition cadence.
Output failure is transactional: firmware retains and retries the same encoded
packet with a scheduler delay instead of discarding it or dequeuing more samples.
The queue therefore accumulates a disconnected-transport backlog. If an outage
outlasts the queue, acquisition drops and counts new samples while preserving the
oldest queued data for ordered delivery after reconnection.
## Forced transport-outage validation
A temporary validation build made the packet writer report transport failure for
a fixed interval while acquisition continued normally. The failure injection was
removed before the production build.
With a three-second forced outage, all 2,144 observed samples arrived contiguously
from sequence 0 through 2,143. Packet gaps, sample gaps, drops, loop overruns, and
timestamp-saturation flags were all zero.
With a seven-second forced outage, the queue preserved samples 0 through 511 and
then dropped 138 new samples after reaching capacity. Delivery resumed at sample
650. The cumulative drop count and observed sequence gap both equaled 138. The
timestamp difference from sample 511 to 650 was exactly 1,390,000 us, matching
139 sample intervals, and no saturation flag was emitted. This verifies both the
oldest-data retention policy and the new exact timestamp re-anchor after overflow.