Mergemaster - #149
Merged
Merged
Conversation
Extend set_galvo_scan with three new parameters: - overscan_samples: linear ramp extension to compensate galvo lag - laser_blanking: gate laser pin during imaging window only - hw_pixel_clock: use RMT peripheral for hardware-equidistant pixel clock Also improves docstring with detailed parameter descriptions and updates the example JSON payload.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the UC2 REST client APIs to support newer firmware capabilities: closed-loop/encoder feedback for motor axes (via CANopen SDO bridging) and enhanced galvo scanning configuration plus direct XY positioning.
Changes:
- Add motor closed-loop axis feedback utilities (SDO read/write helpers, feedback/calibration/reset APIs) and async axis fault event callbacks.
- Extend galvo scan configuration payload with overscan, laser blanking, and optional hardware pixel clock parameters.
- Add galvo direct positioning (
set_position) and re-enablelaser_triggerforwarding for arbitrary-point scans.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| uc2rest/motor.py | Adds async axis-event callback plumbing and new CANopen SDO-based closed-loop/encoder feedback APIs. |
| uc2rest/galvo.py | Expands scan configuration options, adds a static positioning API, and forwards laser_trigger for point scanning. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+58
to
+60
| # Register callback for async closed-loop axis fault events (design v2): | ||
| # {"axisEvent":{"axis":n,"fault":"STALL","posErrSteps":-142,...}} | ||
| self._parent.serial.register_callback(self._callback_axis_event, pattern="axisEvent") |
Comment on lines
+153
to
+161
| path = '/galvo_act' | ||
| payload = { | ||
| "task": path, | ||
| "galvo": { | ||
| "x": int(x), | ||
| "y": int(y) | ||
| } | ||
| } | ||
| return self._parent.post_json(path, payload, timeout=timeout) |
Comment on lines
+252
to
+254
| if not isinstance(resp, dict) or resp.get("status") != "ok": | ||
| return None | ||
| return True if op == "w" else resp.get("value", None) |
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.
No description provided.