probe: Make sure z is homed before probing

Warn if the Z axis is not homed before attempting to probe.  This
improves the error message.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-09-04 12:39:11 -04:00
parent 08adecd226
commit 3bcb6970f5
1 changed files with 6 additions and 4 deletions

View File

@ -8,10 +8,9 @@ import pins, homing
from . import manual_probe from . import manual_probe
HINT_TIMEOUT = """ HINT_TIMEOUT = """
Make sure to home the printer before probing. If the probe If the probe did not move far enough to trigger, then
did not move far enough to trigger, then consider reducing consider reducing the Z axis minimum position so the probe
the Z axis minimum position so the probe can travel further can travel further (the Z minimum position can be negative).
(the Z minimum position can be negative).
""" """
class PrinterProbe: class PrinterProbe:
@ -107,6 +106,9 @@ class PrinterProbe:
return self.x_offset, self.y_offset, self.z_offset return self.x_offset, self.y_offset, self.z_offset
def _probe(self, speed): def _probe(self, speed):
toolhead = self.printer.lookup_object('toolhead') toolhead = self.printer.lookup_object('toolhead')
curtime = self.printer.get_reactor().monotonic()
if 'z' not in toolhead.get_status(curtime)['homed_axes']:
raise self.printer.command_error("Must home before probe")
homing_state = homing.Homing(self.printer) homing_state = homing.Homing(self.printer)
pos = toolhead.get_position() pos = toolhead.get_position()
pos[2] = self.z_position pos[2] = self.z_position