Skip to content

BMG protocot: the FTDI framing shared by BMG's readers, header byte per reader - #1534

Merged
BioCam merged 1 commit into
PyLabRobot:mainfrom
BioCam:bmg-labtech-shared-ftdi-framing
Oct 23, 2026
Merged

BioCam merged 1 commit into
PyLabRobot:mainfrom
BioCam:bmg-labtech-shared-ftdi-framing

Conversation

@BioCam

@BioCam BioCam commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

The Problem

The FTDI framing lives in bmg_labtech/clariostar/driver/framing.py with the header byte fixed to the CLARIOstar's 0x0C, 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 like hamilton/protocol/.
  • pylabrobot/bmg_labtech/protocol/errors.py: FrameError and ChecksumError, moved from the CLARIOstar; pylabrobot.bmg_labtech.clariostar still exports both.
  • The CLARIOstar keeps its USB packet framing and 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.
  • Only the framing moves.

🤖 Generated with Claude Code

… 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
BioCam marked this pull request as ready for review October 23, 2026 15:38
@BioCam BioCam changed the title BMG protocol: the FTDI framing shared by BMG's readers, header byte per reader BMG protocot: the FTDI framing shared by BMG's readers, header byte per reader Oct 23, 2026
@BioCam
BioCam merged commit 27ad762 into PyLabRobot:main Oct 23, 2026
28 checks passed
@BioCam
BioCam deleted the bmg-labtech-shared-ftdi-framing branch October 23, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant