diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-03-14 15:30:58 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-03-17 13:47:31 -0400 |
commit | 36612fd5441b60f9979c0ee966667ede9b779a1d (patch) | |
tree | 9536b8cedc8f79d3d9153a4e0c7b1d66b1990744 /klippy/extras | |
parent | ef8c464d9777699dcedb0325c666d2a4b134e78a (diff) | |
download | kutter-36612fd5441b60f9979c0ee966667ede9b779a1d.tar.gz kutter-36612fd5441b60f9979c0ee966667ede9b779a1d.tar.xz kutter-36612fd5441b60f9979c0ee966667ede9b779a1d.zip |
probe: Default z_position to the configured minimum position on Z axis
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras')
-rw-r--r-- | klippy/extras/probe.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/klippy/extras/probe.py b/klippy/extras/probe.py index 18ffa121..cd4bec5a 100644 --- a/klippy/extras/probe.py +++ b/klippy/extras/probe.py @@ -7,21 +7,22 @@ import pins, homing HINT_TIMEOUT = """ Make sure to home the printer before probing. If the probe -did not move far enough to trigger, then consider setting -the probe z_position (and the Z axis minimum position) to a -negative value. -""" -HINT_MOVE_ERROR = """ -Make sure the probe z_position is in range of the Z axis -minimum and maximum position. (The minimum position may -be set to a negative number.) +did not move far enough to trigger, then consider reducing +the Z axis minimum position so the probe can travel further +(the Z minimum position can be negative). """ class PrinterProbe: def __init__(self, config): self.printer = config.get_printer() self.speed = config.getfloat('speed', 5.0) - self.z_position = config.getfloat('z_position', 0.) + # Infer Z position to move to during a probe + if config.has_section('stepper_z'): + zconfig = config.getsection('stepper_z') + self.z_position = zconfig.getfloat('position_min', 0.) + else: + pconfig = config.getsection('printer') + self.z_position = pconfig.getfloat('minimum_z_position', 0.) # Create an "endstop" object to handle the probe pin ppins = self.printer.lookup_object('pins') pin_params = ppins.lookup_pin('endstop', config.get('pin')) @@ -66,8 +67,6 @@ class PrinterProbe: reason = str(e) if "Timeout during endstop homing" in reason: reason += HINT_TIMEOUT - elif "Move out of range" in reason: - reason += HINT_MOVE_ERROR raise self.gcode.error(reason) self.gcode.reset_last_position() cmd_QUERY_PROBE_help = "Return the status of the z-probe" |