-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
recenter toolhead before each measurement #196
base: main
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis pull request introduces a change to recenter the toolhead before each measurement in both the axes shaper calibration and compare belts responses commands. This ensures that measurements are taken from a consistent starting point, improving the accuracy and reliability of the calibration process. Sequence diagram for toolhead recentering before measurementsequenceDiagram
participant C as Calibration System
participant T as Toolhead
participant M as Measurements Manager
loop For each axis configuration
C->>T: manual_move(point, feedrate_travel)
C->>T: dwell(0.5)
C->>T: wait_moves()
C->>M: Initialize MeasurementsManager
Note over C,M: Continue with measurements
end
Flow diagram for enhanced measurement processflowchart TD
A[Start Measurement] --> B[Filter Axis Configuration]
B --> C[Enter Axis Loop]
C --> D[Recenter Toolhead]
D --> E[Wait 0.5s]
E --> F[Wait for Moves to Complete]
F --> G[Initialize Measurements]
G --> H[Perform Measurements]
H --> I{More Axes?}
I -->|Yes| C
I -->|No| J[End]
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Zeanon - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider extracting the recentering code into a shared helper function to avoid duplication, but this can be done as a separate improvement
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
toolhead.manual_move(point, feedrate_travel) | ||
toolhead.dwell(0.5) | ||
toolhead.wait_moves() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Consider extracting these toolhead operations into a shared utility function
This exact sequence appears in multiple files. To improve maintainability and reduce duplication, consider moving it to a shared utility function like ensure_toolhead_position()
.
Suggested implementation:
a for a in AXIS_CONFIG if a['axis'] == axis_input or (axis_input == 'all' and a['axis'] in ('x', 'y'))
]
def ensure_toolhead_position(toolhead, point, feedrate):
"""Moves toolhead to specified position and ensures movement is complete.
Args:
toolhead: The toolhead object to control
point: The target position to move to
feedrate: The feedrate for the movement
"""
toolhead.manual_move(point, feedrate)
toolhead.dwell(0.5)
toolhead.wait_moves()
for config in filtered_config:
ensure_toolhead_position(toolhead, point, feedrate_travel)
measurements_manager = MeasurementsManager(st_process.get_st_config().chunk_size)
Since this sequence appears in multiple files, you may want to:
- Move the
ensure_toolhead_position
function to a shared utilities module (e.g.,shaketune/utils/toolhead.py
) - Import and use it from all the files where this sequence is needed
- Update all other occurrences of this sequence to use the new utility function
fixes #194
Summary by Sourcery
Bug Fixes: