Skip to content

feat(transport): pyserial SerialTransport (the hardware boundary) - #6

Merged
CameronBrooks11 merged 1 commit into
mainfrom
feat/serial-transport
Jun 26, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
feat/serial-transport

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Closes #2.

The remaining piece of the MarlinHost payload: the real serial wire, so the library can drive hardware.

Changes

  • SerialTransport behind an optional marlin-host[serial] extra — wraps pyserial, ASCII line encode/decode, and on open toggles DTR to reset the controller (it reboots, emits start, which connect() drains). pyserial is typed as Any so the optional dep never leaks into the type-checked surface; the library stays pure without the extra.
  • Broaden MarlinHost.stream() to accept any Iterable[str] — so a .gcode file streams directly.
  • README: real-hardware usage example.

Verification

  • ruff + pyright clean · 70 tests (4 new, pyserial mocked) · CI codegen drift-gate unaffected.

⚠️ Hardware-unvalidated

The DTR-reset timing in SerialTransport.reset() is board-specific and not yet validated against hardware — expect to tune it during the first lab session (tracked under #4). Everything else is exercised hardware-free via FakeTransport.

Add SerialTransport behind an optional `marlin-host[serial]` extra: it
wraps pyserial, encodes/decodes ASCII lines, and on open toggles DTR to
reset the controller (so it reboots and emits `start`, which connect()
drains). pyserial is typed as Any so the optional dep never leaks into
the type-checked surface; the library stays pure without the extra.

Also broaden MarlinHost.stream() to accept any Iterable[str] so a .gcode
file streams directly, and document real-hardware usage in the README.

The DTR-reset timing is board-specific and unvalidated against hardware —
expect to tune SerialTransport.reset() during the first lab session.

Closes #2.
@CameronBrooks11
CameronBrooks11 merged commit 96755b8 into main Jun 26, 2026
5 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/serial-transport branch June 26, 2026 05:32
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.

feat: MarlinHost — connection lifecycle + reliable send + emergency stop

1 participant