Repository navigation
BMG protocot: the FTDI framing shared by BMG's readers, header byte per reader - #1534
Merged
Merged
Conversation
… per reader BMG's readers share one FTDI frame (STX, size, header, payload, 24-bit sum, CR) and differ only in the header byte. The framing and its errors move to pylabrobot/bmg_labtech/protocol/ with the header as an argument; the CLARIOstar passes 0x0C and sends the same bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BioCam
marked this pull request as ready for review
October 23, 2026 15:38
protocol: the FTDI framing shared by BMG's readers, header byte per reader
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 Problem
The FTDI framing lives in
bmg_labtech/clariostar/driver/framing.pywith the header byte fixed to the CLARIOstar's0x0C, so no other BMG reader can use it. The frame -STX | size (2 BE) | header | payload | checksum (3 BE) | CR, the checksum the 24-bit sum of the bytes before it - is BMG's, not the CLARIOstar's: BMG's readers differ in the header byte only. Keeping it inside the CLARIOstar means a second BMG driver copies it or imports from another device's package.PR Content
pylabrobot/bmg_labtech/protocol/framing.py:ftdi_wrap_payload(payload, *, header),ftdi_validate_frame(frame, *, header),ftdi_extract_payload(frame),FTDI_STX,FTDI_CR,FTDI_OVERHEAD- the CLARIOstar's code, with the header byte as an argument. Laid out likehamilton/protocol/.pylabrobot/bmg_labtech/protocol/errors.py:FrameErrorandChecksumError, moved from the CLARIOstar;pylabrobot.bmg_labtech.clariostarstill exports both.FTDI_HEADER = 0x0C, passes it to the shared functions, and sends the same bytes; its framing tests and recordings replay unchanged.protocol/framing_tests.py: recorded CLARIOstar frames round-trip and validate with their header and fail with another; a different header byte changes only byte 3 and the checksum.🤖 Generated with Claude Code