From 89183edbda903c14a21fa712418b06979c25f732 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 13 Dec 2020 10:18:39 -0500 Subject: [PATCH] manual_probe: Use configfile note_valid=False when inspecting Z position_endstop Signed-off-by: Kevin O'Connor --- config/printer-creality-cr20-pro-2019.cfg | 1 - config/printer-mtw-create-2015.cfg | 2 +- config/printer-wanhao-duplicator-9-2018.cfg | 1 - docs/Config_Changes.md | 5 +++++ klippy/extras/manual_probe.py | 15 +++++++-------- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/config/printer-creality-cr20-pro-2019.cfg b/config/printer-creality-cr20-pro-2019.cfg index 8de483bd..cd868e29 100644 --- a/config/printer-creality-cr20-pro-2019.cfg +++ b/config/printer-creality-cr20-pro-2019.cfg @@ -29,7 +29,6 @@ dir_pin: !PL1 enable_pin: !PK0 step_distance: .0025 endstop_pin: probe:z_virtual_endstop -position_endstop: 0 position_max: 250 homing_speed: 10.0 position_min: -1.0 diff --git a/config/printer-mtw-create-2015.cfg b/config/printer-mtw-create-2015.cfg index fe6e1c4e..74f0056c 100644 --- a/config/printer-mtw-create-2015.cfg +++ b/config/printer-mtw-create-2015.cfg @@ -33,7 +33,7 @@ enable_pin: !PA5 step_distance: .00125 endstop_pin: probe:z_virtual_endstop #endstop_pin: ^PC7 -position_endstop: 0.5 +#position_endstop: 0.5 position_max: 225 [extruder] diff --git a/config/printer-wanhao-duplicator-9-2018.cfg b/config/printer-wanhao-duplicator-9-2018.cfg index 35c3a3a7..2763d099 100644 --- a/config/printer-wanhao-duplicator-9-2018.cfg +++ b/config/printer-wanhao-duplicator-9-2018.cfg @@ -30,7 +30,6 @@ dir_pin: ar69 enable_pin: !ar66 step_distance: .0025 endstop_pin: probe:z_virtual_endstop -position_endstop: 1.4 position_max: 370 position_min: -0.99 diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md index ff3a2028..c973c6fa 100644 --- a/docs/Config_Changes.md +++ b/docs/Config_Changes.md @@ -6,6 +6,11 @@ All dates in this document are approximate. # Changes +20201213: It is not valid to specify a Z "position_endstop" when using +"probe:z_virtual_endstop". An error will now be raised if a Z +"position_endstop" is specified with "probe:z_virtual_endstop". +Remove the Z "position_endstop" definition to fix the error. + 20201120: The `[board_pins]` config section now specifies the mcu name in an explicit `mcu:` parameter. If using board_pins for a secondary mcu, then the config must be updated to specify that name. See the diff --git a/klippy/extras/manual_probe.py b/klippy/extras/manual_probe.py index e678bdf7..69ce79e9 100644 --- a/klippy/extras/manual_probe.py +++ b/klippy/extras/manual_probe.py @@ -12,14 +12,13 @@ class ManualProbe: self.gcode = self.printer.lookup_object('gcode') self.gcode.register_command('MANUAL_PROBE', self.cmd_MANUAL_PROBE, desc=self.cmd_MANUAL_PROBE_help) - self.z_position_endstop = None - if config.has_section('stepper_z'): - zconfig = config.getsection('stepper_z') - if zconfig.get_prefix_options('position_endstop'): - self.z_position_endstop = zconfig.getfloat('position_endstop') - self.gcode.register_command( - 'Z_ENDSTOP_CALIBRATE', self.cmd_Z_ENDSTOP_CALIBRATE, - desc=self.cmd_Z_ENDSTOP_CALIBRATE_help) + zconfig = config.getsection('stepper_z') + self.z_position_endstop = zconfig.getfloat('position_endstop', None, + note_valid=False) + if self.z_position_endstop is not None: + self.gcode.register_command( + 'Z_ENDSTOP_CALIBRATE', self.cmd_Z_ENDSTOP_CALIBRATE, + desc=self.cmd_Z_ENDSTOP_CALIBRATE_help) def manual_probe_finalize(self, kin_pos): if kin_pos is not None: self.gcode.respond_info("Z position is %.3f" % (kin_pos[2],))