mirror of https://github.com/Desuuuu/klipper.git
probe: Refactor z lift code to its own function.
Call lift-z prior to the first move. This prevents the nozzle from hitting the build surface in situations that home the nozzle off and below the bed. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
4acda88e8d
commit
1588426229
|
@ -180,6 +180,15 @@ class ProbePointsHelper:
|
||||||
return self.probe.last_home_position()
|
return self.probe.last_home_position()
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
def lift_z(self, z_pos):
|
||||||
|
# Lift toolhead
|
||||||
|
curpos = self.toolhead.get_position()
|
||||||
|
curpos[2] = z_pos
|
||||||
|
try:
|
||||||
|
self.toolhead.move(curpos, self.lift_speed)
|
||||||
|
except homing.EndstopError as e:
|
||||||
|
self.finalize(False)
|
||||||
|
raise self.gcode.error(str(e))
|
||||||
def start_probe(self):
|
def start_probe(self):
|
||||||
# Begin probing
|
# Begin probing
|
||||||
self.toolhead = self.printer.lookup_object('toolhead')
|
self.toolhead = self.printer.lookup_object('toolhead')
|
||||||
|
@ -191,6 +200,7 @@ class ProbePointsHelper:
|
||||||
'NEXT', self.cmd_NEXT, desc=self.cmd_NEXT_help)
|
'NEXT', self.cmd_NEXT, desc=self.cmd_NEXT_help)
|
||||||
self.results = []
|
self.results = []
|
||||||
self.busy = True
|
self.busy = True
|
||||||
|
self.lift_z(self.horizontal_move_z)
|
||||||
self.move_next()
|
self.move_next()
|
||||||
if self.probe is not None:
|
if self.probe is not None:
|
||||||
try:
|
try:
|
||||||
|
@ -218,13 +228,7 @@ class ProbePointsHelper:
|
||||||
self.toolhead.wait_moves()
|
self.toolhead.wait_moves()
|
||||||
self.results.append(self.callback.get_probed_position())
|
self.results.append(self.callback.get_probed_position())
|
||||||
# Lift toolhead
|
# Lift toolhead
|
||||||
curpos = self.toolhead.get_position()
|
self.lift_z(self.horizontal_move_z)
|
||||||
curpos[2] = self.horizontal_move_z
|
|
||||||
try:
|
|
||||||
self.toolhead.move(curpos, self.lift_speed)
|
|
||||||
except homing.EndstopError as e:
|
|
||||||
self.finalize(False)
|
|
||||||
raise self.gcode.error(str(e))
|
|
||||||
# Move to next position
|
# Move to next position
|
||||||
if len(self.results) == len(self.probe_points):
|
if len(self.results) == len(self.probe_points):
|
||||||
self.toolhead.get_last_move_time()
|
self.toolhead.get_last_move_time()
|
||||||
|
|
Loading…
Reference in New Issue