Fix live UART data loss and time-axis glitches - #16
Merged
Conversation
The live serial reader rebuilt the full time/sum/spectral history from scratch on every incoming record, making per-record work grow with session length; once that fell behind the incoming baud rate, the OS serial buffer could overflow and drop bytes. It also used readline() with a timeout, which silently truncates a line that arrives slower than the timeout, corrupting or dropping that record. Parsing failures were swallowed with bare `except: pass`, so none of this was visible. - Replace the growing-list-to-array rebuild with amortized O(1) append buffers (_GrowableArray/_GrowableMatrix) so per-record cost stays constant over a session. - Read raw bytes and split on '\n' ourselves instead of relying on readline(timeout=...), so a slow/bursty record is only parsed once it has fully arrived. - Log dropped/malformed records instead of discarding them silently. - Drop the $STOP timestamp fallback that substituted the run index for time (compressing the x-axis); fall back to host wall-clock time only when the device itself reports no timestamp (no RTC). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NcmUFSZ3EJwkN4DcJpcMKN
roman-dvorak
approved these changes
Sep 2, 2026
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.
The live serial reader rebuilt the full time/sum/spectral history from scratch on every incoming record, making per-record work grow with session length; once that fell behind the incoming baud rate, the OS serial buffer could overflow and drop bytes. It also used readline() with a timeout, which silently truncates a line that arrives slower than the timeout, corrupting or dropping that record. Parsing failures were swallowed with bare
except: pass, so none of this was visible.