aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/manual_probe.py
diff options
context:
space:
mode:
authorDmitry Butyugin <dmbutyugin@google.com>2025-05-10 20:25:46 +0200
committerKevin O'Connor <kevin@koconnor.net>2025-05-10 20:16:00 -0400
commitca83c13f375578baa289a18ff31a5f602ae74225 (patch)
tree63d0b185c720d462a33e7b0c4b2fe2f76274a4ce /klippy/extras/manual_probe.py
parent8627c94d6ad6044e9d2add6e40b08c8684251f85 (diff)
downloadkutter-ca83c13f375578baa289a18ff31a5f602ae74225.tar.gz
kutter-ca83c13f375578baa289a18ff31a5f602ae74225.tar.xz
kutter-ca83c13f375578baa289a18ff31a5f602ae74225.zip
generic_cartesian: Fixed safe_z_home and manual_probe for new kinematics
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/manual_probe.py')
-rw-r--r--klippy/extras/manual_probe.py35
1 files changed, 25 insertions, 10 deletions
diff --git a/klippy/extras/manual_probe.py b/klippy/extras/manual_probe.py
index 496455fa..92f2d0f6 100644
--- a/klippy/extras/manual_probe.py
+++ b/klippy/extras/manual_probe.py
@@ -5,6 +5,14 @@
# This file may be distributed under the terms of the GNU GPLv3 license.
import logging, bisect
+# Helper to lookup the Z stepper config section
+def lookup_z_endstop_config(config):
+ if config.has_section('stepper_z'):
+ return config.getsection('stepper_z')
+ elif config.has_section('carriage z'):
+ return config.getsection('carriage z')
+ return None
+
class ManualProbe:
def __init__(self, config):
self.printer = config.get_printer()
@@ -14,9 +22,13 @@ class ManualProbe:
self.gcode.register_command('MANUAL_PROBE', self.cmd_MANUAL_PROBE,
desc=self.cmd_MANUAL_PROBE_help)
# Endstop value for cartesian printers with separate Z axis
- zconfig = config.getsection('stepper_z')
- self.z_position_endstop = zconfig.getfloat('position_endstop', None,
- note_valid=False)
+ zconfig = lookup_z_endstop_config(config)
+ if zconfig is not None:
+ self.z_position_endstop = zconfig.getfloat('position_endstop', None,
+ note_valid=False)
+ self.z_endstop_config_name = zconfig.get_name()
+ else:
+ self.z_position_endstop = self.z_endstop_config_name = None
# Endstop values for linear delta printers with vertical A,B,C towers
a_tower_config = config.getsection('stepper_a')
self.a_position_endstop = a_tower_config.getfloat('position_endstop',
@@ -67,11 +79,13 @@ class ManualProbe:
return
z_pos = self.z_position_endstop - kin_pos[2]
self.gcode.respond_info(
- "stepper_z: position_endstop: %.3f\n"
+ "%s: position_endstop: %.3f\n"
"The SAVE_CONFIG command will update the printer config file\n"
- "with the above and restart the printer." % (z_pos,))
+ "with the above and restart the printer." % (
+ self.z_endstop_config_name, z_pos,))
configfile = self.printer.lookup_object('configfile')
- configfile.set('stepper_z', 'position_endstop', "%.3f" % (z_pos,))
+ configfile.set(self.z_endstop_config_name, 'position_endstop',
+ "%.3f" % (z_pos,))
cmd_Z_ENDSTOP_CALIBRATE_help = "Calibrate a Z endstop"
def cmd_Z_ENDSTOP_CALIBRATE(self, gcmd):
ManualProbeHelper(self.printer, gcmd, self.z_endstop_finalize)
@@ -83,11 +97,12 @@ class ManualProbe:
else:
new_calibrate = self.z_position_endstop - offset
self.gcode.respond_info(
- "stepper_z: position_endstop: %.3f\n"
+ "%s: position_endstop: %.3f\n"
"The SAVE_CONFIG command will update the printer config file\n"
- "with the above and restart the printer." % (new_calibrate))
- configfile.set('stepper_z', 'position_endstop',
- "%.3f" % (new_calibrate,))
+ "with the above and restart the printer." % (
+ self.z_endstop_config_name, new_calibrate))
+ configfile.set(self.z_endstop_config_name, 'position_endstop',
+ "%.3f" % (new_calibrate,))
def cmd_Z_OFFSET_APPLY_DELTA_ENDSTOPS(self,gcmd):
offset = self.gcode_move.get_status()['homing_origin'].z
configfile = self.printer.lookup_object('configfile')