safe_z_home: Make sure X and Y are homed before homing Z (#3153)
In it's current behavior, safe_z_home will attempt to home Z if it thinks the toolhead is above the z endstop even if the motors have since been disabled and the toolhead was moved to another position Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
This commit is contained in:
parent
fe84968bdc
commit
10987003b0
|
@ -30,12 +30,12 @@ class SafeZHoming:
|
|||
|
||||
def cmd_G28(self, gcmd):
|
||||
toolhead = self.printer.lookup_object('toolhead')
|
||||
curtime = self.printer.get_reactor().monotonic()
|
||||
kin_status = toolhead.get_kinematics().get_status(curtime)
|
||||
|
||||
# Perform Z Hop if necessary
|
||||
if self.z_hop != 0.0:
|
||||
pos = toolhead.get_position()
|
||||
curtime = self.printer.get_reactor().monotonic()
|
||||
kin_status = toolhead.get_kinematics().get_status(curtime)
|
||||
# Check if Z axis is homed or has a known position
|
||||
if 'z' in kin_status['homed_axes']:
|
||||
# Check if the zhop would exceed the printer limits
|
||||
|
@ -65,14 +65,23 @@ class SafeZHoming:
|
|||
if new_params:
|
||||
g28_gcmd = self.gcode.create_gcode_command("G28", "G28", new_params)
|
||||
self.prev_G28(g28_gcmd)
|
||||
|
||||
# Update the currently homed axes
|
||||
curtime = self.printer.get_reactor().monotonic()
|
||||
kin_status = toolhead.get_kinematics().get_status(curtime)
|
||||
|
||||
# Home Z axis if necessary
|
||||
if need_z:
|
||||
# Move to safe XY homing position
|
||||
pos = toolhead.get_position()
|
||||
prev_x = pos[0]
|
||||
prev_y = pos[1]
|
||||
pos[0] = self.home_x_pos
|
||||
pos[1] = self.home_y_pos
|
||||
# Throw an error if X or Y are not homed
|
||||
if ('x' not in kin_status['homed_axes'] or
|
||||
'y' not in kin_status['homed_axes']):
|
||||
raise gcmd.error("Must home X and Y axes first")
|
||||
# Move to safe XY homing position
|
||||
toolhead.move(pos, self.speed)
|
||||
self.gcode.reset_last_position()
|
||||
# Home Z
|
||||
|
|
Loading…
Reference in New Issue