Repository navigation
feat(transport): pyserial SerialTransport (the hardware boundary) - #6
Merged
Merged
Conversation
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.
3 of 14 tasks
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.
Closes #2.
The remaining piece of the MarlinHost payload: the real serial wire, so the library can drive hardware.
Changes
SerialTransportbehind an optionalmarlin-host[serial]extra — wraps pyserial, ASCII line encode/decode, and on open toggles DTR to reset the controller (it reboots, emitsstart, whichconnect()drains). pyserial is typed asAnyso the optional dep never leaks into the type-checked surface; the library stays pure without the extra.MarlinHost.stream()to accept anyIterable[str]— so a.gcodefile streams directly.Verification
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 viaFakeTransport.