aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authorjanherich <jan.herich@gmail.com>2022-11-25 13:09:56 +0100
committerKevinOConnor <kevin@koconnor.net>2022-12-19 13:14:06 -0500
commitf078a279059670e692ea676237b152b4d42518e4 (patch)
treea7f219e8fc4a8f0dea30e2151c466bdc831ba722 /klippy
parent8621ebbed20e726acaad3922845cf141cd9e3d31 (diff)
downloadkutter-f078a279059670e692ea676237b152b4d42518e4.tar.gz
kutter-f078a279059670e692ea676237b152b4d42518e4.tar.xz
kutter-f078a279059670e692ea676237b152b4d42518e4.zip
manual_probe: Add Z_OFFSET_APPLY_ENDSTOP for delta
Current Z_OFFSET_APPLY_ENDSTOP command only works for printers with cartesian architecture which have separate Z axis defined. But this functionality (persisting Z babystep value to endstops) is exactly as convinient for delta printers, therefore this PR implements it. Signed-off-by: Jan Herich <jan.herich@gmail.com>
Diffstat (limited to 'klippy')
-rw-r--r--klippy/extras/manual_probe.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/klippy/extras/manual_probe.py b/klippy/extras/manual_probe.py
index c6e9dc64..496455fa 100644
--- a/klippy/extras/manual_probe.py
+++ b/klippy/extras/manual_probe.py
@@ -13,9 +13,25 @@ class ManualProbe:
self.gcode_move = self.printer.load_object(config, "gcode_move")
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)
+ # 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',
+ None,
+ note_valid=False)
+ b_tower_config = config.getsection('stepper_b')
+ self.b_position_endstop = b_tower_config.getfloat('position_endstop',
+ None,
+ note_valid=False)
+ c_tower_config = config.getsection('stepper_c')
+ self.c_position_endstop = c_tower_config.getfloat('position_endstop',
+ None,
+ note_valid=False)
+ # Conditionally register appropriate commands depending on printer
+ # Cartestian printers with separate Z Axis
if self.z_position_endstop is not None:
self.gcode.register_command(
'Z_ENDSTOP_CALIBRATE', self.cmd_Z_ENDSTOP_CALIBRATE,
@@ -24,6 +40,12 @@ class ManualProbe:
'Z_OFFSET_APPLY_ENDSTOP',
self.cmd_Z_OFFSET_APPLY_ENDSTOP,
desc=self.cmd_Z_OFFSET_APPLY_ENDSTOP_help)
+ # Linear delta printers with A,B,C towers
+ if 'delta' == config.getsection('printer').get('kinematics'):
+ self.gcode.register_command(
+ 'Z_OFFSET_APPLY_ENDSTOP',
+ self.cmd_Z_OFFSET_APPLY_DELTA_ENDSTOPS,
+ desc=self.cmd_Z_OFFSET_APPLY_ENDSTOP_help)
self.reset_status()
def manual_probe_finalize(self, kin_pos):
if kin_pos is not None:
@@ -66,6 +88,29 @@ class ManualProbe:
"with the above and restart the printer." % (new_calibrate))
configfile.set('stepper_z', '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')
+ if offset == 0:
+ self.gcode.respond_info("Nothing to do: Z Offset is 0")
+ else:
+ new_a_calibrate = self.a_position_endstop - offset
+ new_b_calibrate = self.b_position_endstop - offset
+ new_c_calibrate = self.c_position_endstop - offset
+ self.gcode.respond_info(
+ "stepper_a: position_endstop: %.3f\n"
+ "stepper_b: position_endstop: %.3f\n"
+ "stepper_c: position_endstop: %.3f\n"
+ "The SAVE_CONFIG command will update the printer config file\n"
+ "with the above and restart the printer." % (new_a_calibrate,
+ new_b_calibrate,
+ new_c_calibrate))
+ configfile.set('stepper_a', 'position_endstop',
+ "%.3f" % (new_a_calibrate,))
+ configfile.set('stepper_b', 'position_endstop',
+ "%.3f" % (new_b_calibrate,))
+ configfile.set('stepper_c', 'position_endstop',
+ "%.3f" % (new_c_calibrate,))
cmd_Z_OFFSET_APPLY_ENDSTOP_help = "Adjust the z endstop_position"
# Verify that a manual probe isn't already in progress