-
Notifications
You must be signed in to change notification settings - Fork 6
File unit interpretation #1237
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
base: master
Are you sure you want to change the base?
File unit interpretation #1237
Changes from all commits
d47d8e4
c7f91f7
2866282
98cb33f
332dc39
95aa03a
6d8bd34
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -339,6 +339,8 @@ class JobRecoveryScreen(Screen): | |
| scroll_up_event = None | ||
| scroll_down_event = None | ||
|
|
||
| using_inches = False | ||
|
|
||
| def __init__(self, **kwargs): | ||
| super(JobRecoveryScreen, self).__init__(**kwargs) | ||
| self.sm = kwargs["screen_manager"] | ||
|
|
@@ -531,6 +533,14 @@ def update_display(self): | |
| ) | ||
| else: | ||
| self.pos_z = 0.0 | ||
|
|
||
| # Check if these distances are measured in inches, so that GO XY can work correctly | ||
| unit_line = next((s for s in reversed(self.jd.job_gcode[:self.selected_line_index + 1]) if re.search("G2[0,1]", s)), None) | ||
| if unit_line: | ||
| self.using_inches = "G20" in unit_line | ||
| else: | ||
| self.using_inches = False | ||
|
|
||
| self.pos_label.text = "wX: %s | wY: %s | wZ: %s" % ( | ||
| str(self.pos_x), | ||
| str(self.pos_y), | ||
|
|
@@ -584,13 +594,18 @@ def get_info(self): | |
| popup_info.PopupScrollableInfo(self.sm, self.l, 760, info) | ||
|
|
||
| def go_xy(self): | ||
| # Pick min out of safe z height and limit_switch_safety_distance, in case positive value is calculated, which causes errors | ||
| z_safe_height = min( | ||
| self.m.z_wco() + self.sm.get_screen("home").job_box.range_z[1], | ||
| -self.m.limit_switch_safety_distance, | ||
| ) | ||
| # If Z is below safe height, then raise it up | ||
| if self.m.mpos_z() < z_safe_height: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspect that G20 changes the pos read? So this logic might not work after the unit change |
||
| self.m.s.write_command("G53 G0 Z%s F750" % z_safe_height) | ||
| self.m.s.write_command("G90 G0 X%s Y%s" % (self.pos_x, self.pos_y)) | ||
| if self.using_inches: | ||
| self.m.set_machine_unit_to_inch() | ||
| self.m.s.write_command('G90 G0 X%s Y%s' % (self.pos_x, self.pos_y)) | ||
| self.m.set_machine_unit_to_mm() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you switch back to mm if the recovered file is in inches? Doesn't that mean, that when you re-run the job from the recover position all subsequent moves will be in mm again?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function is just used for the GO XY button on the job recovery screen - it sets to inches just while it moves to the position currently being displayed on that screen, then it needs to go back to mm, and when the user runs the job recovery file, then it will insert the G20 back in |
||
|
|
||
| def back_to_home(self): | ||
| self.jd.reset_recovery() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.