Skip to content

File unit interpretation#1237

Open
DennisKiselev wants to merge 7 commits intomasterfrom
file_unit_interpretation
Open

File unit interpretation#1237
DennisKiselev wants to merge 7 commits intomasterfrom
file_unit_interpretation

Conversation

@DennisKiselev
Copy link
Copy Markdown
Contributor

Two different fixes related to G20/G21 unit gcodes:

  • When a stream ends, a G21 is sent to change the machine back to mm, in case the file used inches
  • When using the GO XY button in job recovery, the last G20/G21 command is accounted for so that the position is accurately found.

Tested on windows, by using manual move and doing 1mm movements and seeing if it goes way too far

log("Ending stream...")

# Always switch to mm, in case the job put you in inches
self.write_command('G21')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to have this (for both unit options) as a readable router_machine function, like zUp, spindle_off etc.

self.m.s.write_command('G20')

# If Z is below safe height, then raise it up
if self.m.mpos_z() < z_safe_height:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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

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()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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

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.

3 participants