From 8215781b1f005d70fc0b3993c46d493f1a0dc841 Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Mon, 12 Feb 2024 13:36:13 +0000 Subject: [PATCH] =?UTF-8?q?STEAPP-733:=20Added=20recursive=20offset=20meas?= =?UTF-8?q?urement=20for=20the=20=D0=A1-axis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- klippy/extras/c_axis_align.py | 10 +++++++++- stereotech_config/calibrate/probe_5d_template.cfg | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/klippy/extras/c_axis_align.py b/klippy/extras/c_axis_align.py index 483974a72394..ae188d8ff325 100644 --- a/klippy/extras/c_axis_align.py +++ b/klippy/extras/c_axis_align.py @@ -24,6 +24,9 @@ def __init__(self, config): self.gcode.register_command( 'SAVE_C_AXIS_POINT', self.cmd_SAVE_C_AXIS_POINT, desc=self.cmd_SAVE_C_AXIS_POINT_help) + self.gcode.register_command( + 'MOVE_ALIGN_C_AXIS', self.cmd_MOVE_ALIGN_C_AXIS, + desc=self.cmd_MOVE_ALIGN_C_AXIS_help) cmd_SAVE_C_AXIS_POINT_help = "Save point for C axis align" @@ -50,12 +53,17 @@ def cmd_ALIGN_C_AXIS(self, gcmd): self.gcode.run_script_from_command("MOVE_ALIGN_C_AXIS") offset = self._calc_c_axis_align( self.point_coords[0], self.point_coords[1]) - if (self.threshold_value * -1) <= offset <= self.threshold_value: + if abs(offset) <= self.threshold_value: logging.info("align the axis C completed") break else: self._apply_offset_c(offset) + cmd_MOVE_ALIGN_C_AXIS_help = "By default, it returns the offset of the\ + axis, if necessary, perform rename_existing of this command in the macro" + def cmd_MOVE_ALIGN_C_AXIS(self, gcmd): + gcmd.respond_info("the MOVE_ALIGN_C_AXIS command is not supported") + def _calc_c_axis_align(self, point_0, point_1): offset = math.atan((point_1[1] - point_0[1]) / 90) * RAD_TO_DEG / 3 logging.info("calculate offset for the axis C: %f." % offset) diff --git a/stereotech_config/calibrate/probe_5d_template.cfg b/stereotech_config/calibrate/probe_5d_template.cfg index f3779d745581..c8276986e1d8 100644 --- a/stereotech_config/calibrate/probe_5d_template.cfg +++ b/stereotech_config/calibrate/probe_5d_template.cfg @@ -33,6 +33,7 @@ gcode: [gcode_macro MOVE_ALIGN_C_AXIS] description: moves for align template along axis X +rename_existing: MOVE_ALIGN_C_AXIS_OLD gcode: PROBE_TEMPLATE_POINT POINT=D_Y SET_POINT MACRO=SAVE_C_AXIS_POINT POINT=1