mirror of https://github.com/Desuuuu/klipper.git
probe: Default z_position to the configured minimum position on Z axis
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
ef8c464d97
commit
36612fd544
|
@ -19,9 +19,6 @@
|
||||||
# Probe detection pin. This parameter must be provided.
|
# Probe detection pin. This parameter must be provided.
|
||||||
#speed: 5.0
|
#speed: 5.0
|
||||||
# Speed (in mm/s) of the Z axis when probing. The default is 5mm/s.
|
# Speed (in mm/s) of the Z axis when probing. The default is 5mm/s.
|
||||||
#z_position: 0.0
|
|
||||||
# The Z position to command the head to move to during a PROBE
|
|
||||||
# command. The default is 0.
|
|
||||||
#activate_gcode:
|
#activate_gcode:
|
||||||
# A list of G-Code commands (one per line) to execute prior to each
|
# A list of G-Code commands (one per line) to execute prior to each
|
||||||
# probe attempt. This may be useful if the probe needs to be
|
# probe attempt. This may be useful if the probe needs to be
|
||||||
|
|
|
@ -7,21 +7,22 @@ import pins, homing
|
||||||
|
|
||||||
HINT_TIMEOUT = """
|
HINT_TIMEOUT = """
|
||||||
Make sure to home the printer before probing. If the probe
|
Make sure to home the printer before probing. If the probe
|
||||||
did not move far enough to trigger, then consider setting
|
did not move far enough to trigger, then consider reducing
|
||||||
the probe z_position (and the Z axis minimum position) to a
|
the Z axis minimum position so the probe can travel further
|
||||||
negative value.
|
(the Z minimum position can be negative).
|
||||||
"""
|
|
||||||
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.)
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class PrinterProbe:
|
class PrinterProbe:
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
self.printer = config.get_printer()
|
self.printer = config.get_printer()
|
||||||
self.speed = config.getfloat('speed', 5.0)
|
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
|
# Create an "endstop" object to handle the probe pin
|
||||||
ppins = self.printer.lookup_object('pins')
|
ppins = self.printer.lookup_object('pins')
|
||||||
pin_params = ppins.lookup_pin('endstop', config.get('pin'))
|
pin_params = ppins.lookup_pin('endstop', config.get('pin'))
|
||||||
|
@ -66,8 +67,6 @@ class PrinterProbe:
|
||||||
reason = str(e)
|
reason = str(e)
|
||||||
if "Timeout during endstop homing" in reason:
|
if "Timeout during endstop homing" in reason:
|
||||||
reason += HINT_TIMEOUT
|
reason += HINT_TIMEOUT
|
||||||
elif "Move out of range" in reason:
|
|
||||||
reason += HINT_MOVE_ERROR
|
|
||||||
raise self.gcode.error(reason)
|
raise self.gcode.error(reason)
|
||||||
self.gcode.reset_last_position()
|
self.gcode.reset_last_position()
|
||||||
cmd_QUERY_PROBE_help = "Return the status of the z-probe"
|
cmd_QUERY_PROBE_help = "Return the status of the z-probe"
|
||||||
|
|
Loading…
Reference in New Issue