From 47805927780df3a9d8fbeac0635c76990a3002dd Mon Sep 17 00:00:00 2001 From: Christian Kvasny Date: Tue, 2 Nov 2021 13:00:20 +0100 Subject: [PATCH] Configurable xy position for z-calibrate added (#310) * Configurable xy position for z-calibrate added * fix coding style * Z probe calibrate option added --- docs/Configuration.md | 9 +++++++++ panels/zcalibrate.py | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/docs/Configuration.md b/docs/Configuration.md index 58f97a91..d02e5fdd 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -62,6 +62,15 @@ moonraker_api_key: False z_babystep_values: 0.01, 0.05 ``` +## Z probe calibrate Option +If for any reason the XYZ home position is not suitable for calibrating the probe Z offset, you can enter the coordinates for the desired position here. +``` +[z_calibrate_position] +# The specified positions must be> 0 otherwise this option is ignored. +# the center of the print bed is a good value +calibrate_x_position: 100 +calibrate_y_position: 100 +``` ## Preheat Options ``` diff --git a/panels/zcalibrate.py b/panels/zcalibrate.py index 9980bb98..602e8623 100644 --- a/panels/zcalibrate.py +++ b/panels/zcalibrate.py @@ -84,6 +84,10 @@ class ZCalibratePanel(ScreenPanel): def activate(self): if self._screen.printer.get_stat("toolhead", "homed_axes") != "xyz": self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME) + x_position = self._config.get_config()['z_calibrate_position'].getint("calibrate_x_position", 0) + y_position = self._config.get_config()['z_calibrate_position'].getint("calibrate_y_position", 0) + if x_position > 0 and y_position > 0: + self._screen._ws.klippy.gcode_script('G0 X%d Y%d F3000' % (x_position, y_position)) self._screen._ws.klippy.gcode_script(KlippyGcodes.PROBE_CALIBRATE) def process_update(self, action, data):