Skip to content

BMG transport: the FTDI interface shared by BMG's readers - #1535

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

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

Conversation

@BioCam

@BioCam BioCam commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

The Problem

CLARIOstarDriver holds its whole FTDI interface: opening the port, reading exactly one reply frame back (the size field ends it, as CR also occurs inside payloads), the bulk-in transfers kept pending so no byte is lost, purge and drain. None of it is the CLARIOstar's beyond its header byte 0x0C and its baud rate: it is how a BMG reader is read over FTDI, so another BMG driver would have to copy about 300 lines of the hardest code to get right, or import it from the CLARIOstar.

PR Content

  • pylabrobot/bmg_labtech/transport/ftdi_interface.py: BMGFTDIInterface(io, *, header, baudrate, packet_read_timeout, frame_stall_timeout, frame_hard_cap) with setup(), exchange(payload), purge_rx(), drain_rx(), stop() - CLARIOstarDriver's FTDI code, moved, with the reader's header byte, baud rate and reply-read timeouts as arguments, none defaulted.
  • pylabrobot/bmg_labtech/transport/ftdi_queued_reads.py: moved unchanged from clariostar/driver/.
  • CLARIOstarDriver keeps its measured timeouts (1 s to a reply's start, 2 s stall, 60 s cap), builds the FTDI interface on first use over its current io with those and header=0x0C, baudrate=125000, and keeps the exchange lock, the retries, its USB interface and the choice between the two; send_command and the features are unchanged, and the CLARIOstar sends and reads the same bytes.
  • Tests point at the driver's FTDI interface with unchanged assertions; every recording replays unchanged.
  • The FTDI interface's warnings (e.g. bulk-in transfers stopped) log under pylabrobot.bmg_labtech.transport.ftdi_interface.

🤖 Generated with Claude Code

The FTDI link of CLARIOstarDriver - opening the port, writing a frame and reading exactly one
reply frame back through the queued bulk-in reads or libftdi, purge and drain - moves to
pylabrobot/bmg_labtech/transport/ as BMGFTDIInterface, taking the reader's header byte, baud
rate and reply-read timeouts; the queued reads move with it. The CLARIOstar keeps its measured
timeouts, the exchange lock, the retries and its USB interface, builds the FTDI interface on
first use over its current io, and sends and reads the same bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BioCam
BioCam force-pushed the bmg-labtech-shared-ftdi-link branch from a7a64e4 to b496d5b Compare October 23, 2026 18:12
@BioCam
BioCam marked this pull request as ready for review October 23, 2026 18:42
@BioCam
BioCam merged commit 0e09b90 into PyLabRobot:main Oct 23, 2026
28 checks passed
@BioCam
BioCam deleted the bmg-labtech-shared-ftdi-link branch October 23, 2026 19:58
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