From 67298292933c5bf133459611ce4466e85acccd86 Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Fri, 2 Feb 2024 14:55:55 +0000 Subject: [PATCH 1/8] Added a message (M117) when the sensor is triggered during printing if the cleaning algorithm is turned off --- stereotech_config/common/filament_control.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/stereotech_config/common/filament_control.cfg b/stereotech_config/common/filament_control.cfg index 8422e0731841..6fee5652fc47 100644 --- a/stereotech_config/common/filament_control.cfg +++ b/stereotech_config/common/filament_control.cfg @@ -88,6 +88,7 @@ gcode: SET_GCODE_VARIABLE MACRO=RECOVER_EXTRUSION VARIABLE=count_triggered_sensor VALUE={printer["gcode_macro RECOVER_EXTRUSION"].count_triggered_sensor + 1} {% if not printer.pause_resume.is_paused %} PAUSE TURN_OFF_EXTRUDERS=1 E=0 STATUS_LED=error_paused + M117 all_attempt_extrude_failed {% endif %} {% endif %} From 28364edec7aa6f1c0d129c0a14714907e7b3a708 Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Fri, 2 Feb 2024 14:58:41 +0000 Subject: [PATCH 2/8] STEAPP-894: changed the message so that the client could display the translation --- stereotech_config/common/filament_control.cfg | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stereotech_config/common/filament_control.cfg b/stereotech_config/common/filament_control.cfg index 6fee5652fc47..a0d4df938163 100644 --- a/stereotech_config/common/filament_control.cfg +++ b/stereotech_config/common/filament_control.cfg @@ -10,11 +10,12 @@ runout_gcode: [gcode_macro RUNOUT_GCODE_MOTION_SENSOR] gcode: {% set extruder = params.EXTRUDER|default('extruder') %} - {% set extruder_for_msg = 'extruder' if extruder == 'extruder' else 'extruder' ~ (extruder[8]|int + 1 ) %} + {% set extruder_index = 0 if extruder == 'extruder' else extruder[-1]|int %} + {% set extruder_for_msg = 'extruder' if extruder == 'extruder' else 'extruder' ~ (extruder_index + 1) %} {% if printer.virtual_sdcard.is_active %} - M117 triggered_filament_sensor{" " ~ extruder_for_msg} - {action_respond_warning('411: The filament has run out or there is a problem with its supply at the %s' % extruder_for_msg)} - RECOVER_EXTRUSION SENSOR={extruder ~ '_sensor'} + M117 {"triggered_filament_sensor" ~ extruder_index} + {action_respond_warning('411: The filament has run out or there is a problem with its supply at the %s' % extruder_for_msg)} + RECOVER_EXTRUSION SENSOR={extruder ~ '_sensor'} {% else %} {action_raise_error('401: Filament error on %s' % extruder_for_msg)} {% endif %} From 4c97fdd57fe0de98b3592c3aef5eceddc7cc9bd5 Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Mon, 5 Feb 2024 14:46:04 +0000 Subject: [PATCH 3/8] =?UTF-8?q?STEAPP-733:=20Added=20recursive=20offset=20?= =?UTF-8?q?measurement=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 | 26 ++++++++++++++----- .../calibrate/probe_5d_template.cfg | 15 ++++------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/klippy/extras/c_axis_align.py b/klippy/extras/c_axis_align.py index fb580505a12b..7a9fd99a5d0f 100644 --- a/klippy/extras/c_axis_align.py +++ b/klippy/extras/c_axis_align.py @@ -10,13 +10,15 @@ def __init__(self, config): self.printer = config.get_printer() self.gcode_move = self.printer.load_object(config, 'gcode_move') self.gcode = self.printer.lookup_object('gcode') + self.max_repeat_probe = config.getint('max_repeat_probe', 5) + self.threshold_value = config.getfloat('threshold_value', 0.02) self.point_coords = [ [0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0.] ] - self.gcode.register_command('CALC_C_AXIS_ALIGN', - self.cmd_CALC_C_AXIS_ALIGN, - desc=self.cmd_CALC_C_AXIS_ALIGN_help) + self.gcode.register_command('ALIGN_C_AXIS', + self.cmd_ALIGN_C_AXIS, + desc=self.cmd_ALIGN_C_AXIS_help) self.gcode.register_command( 'SAVE_C_AXIS_POINT', self.cmd_SAVE_C_AXIS_POINT, desc=self.cmd_SAVE_C_AXIS_POINT_help) @@ -41,18 +43,28 @@ def cmd_SAVE_C_AXIS_POINT(self, gcmd): 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) return offset - def cmd_CALC_C_AXIS_ALIGN(self, gcmd): - offset = self._calc_c_axis_align( - self.point_coords[0], self.point_coords[1]) + def _apply_offset_c(self, offset): align_gcmd = self.gcode.create_gcode_command( 'G0', 'G0', {'C': offset}) self.gcode_move.cmd_G1(align_gcmd) self.gcode_move.cmd_G92(self.gcode.create_gcode_command( 'G92', 'G92', {'C': 0})) - cmd_CALC_C_AXIS_ALIGN_help = "Calculate C axis align" + def cmd_ALIGN_C_AXIS(self, gcmd): + for i in range(self.max_repeat_probe): + 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: + break + else: + self._apply_offset_a(offset) + + + cmd_ALIGN_C_AXIS_help = "Calculate C axis align" def load_config(config): diff --git a/stereotech_config/calibrate/probe_5d_template.cfg b/stereotech_config/calibrate/probe_5d_template.cfg index ac4f80c5076a..1446dd274c25 100644 --- a/stereotech_config/calibrate/probe_5d_template.cfg +++ b/stereotech_config/calibrate/probe_5d_template.cfg @@ -31,18 +31,13 @@ gcode: {% set v = 'v_' if a == 90 else '' %} SET_GCODE_VARIABLE MACRO=PROBE_TEMPLATE_POINT VARIABLE={"a_" ~ v ~"probe_z"} VALUE={printer.probe.last_result[2] - printer.gcode_move.homing_origin.z} -[gcode_macro ALIGN_C_AXIS] +[gcode_macro MOVE_ALIGN_C_AXIS] description: align template along axis x -variable_repeat: 2 gcode: - {% set repeat = printer["gcode_macro ALIGN_C_AXIS"].repeat %} - {% for idx in range(repeat) %} - PROBE_TEMPLATE_POINT POINT=D_Y - SET_POINT MACRO=SAVE_C_AXIS_POINT POINT=1 - PROBE_TEMPLATE_POINT POINT=C_Y - SET_POINT MACRO=SAVE_C_AXIS_POINT POINT=0 - CALC_C_AXIS_ALIGN - {% endfor %} + PROBE_TEMPLATE_POINT POINT=D_Y + SET_POINT MACRO=SAVE_C_AXIS_POINT POINT=1 + PROBE_TEMPLATE_POINT POINT=C_Y + SET_POINT MACRO=SAVE_C_AXIS_POINT POINT=0 [gcode_macro ALIGN_A_AXIS] description: align template along horizontal plane From 1e5a0d920cc940ae308e82f277f4aab5d5ed5d15 Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Tue, 6 Feb 2024 07:37:07 +0000 Subject: [PATCH 4/8] =?UTF-8?q?STEAPP-733:=20Added=20recursive=20offset=20?= =?UTF-8?q?measurement=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 | 37 ++++++++++--------- .../calibrate/probe_5d_template.cfg | 2 +- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/klippy/extras/c_axis_align.py b/klippy/extras/c_axis_align.py index 7a9fd99a5d0f..483974a72394 100644 --- a/klippy/extras/c_axis_align.py +++ b/klippy/extras/c_axis_align.py @@ -1,6 +1,8 @@ # Helper script to automate a axis offset calculation import math +import logging + RAD_TO_DEG = 57.295779513 @@ -16,13 +18,15 @@ def __init__(self, config): [0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0.] ] - self.gcode.register_command('ALIGN_C_AXIS', - self.cmd_ALIGN_C_AXIS, - desc=self.cmd_ALIGN_C_AXIS_help) + self.gcode.register_command( + 'ALIGN_C_AXIS', self.cmd_ALIGN_C_AXIS, + desc=self.cmd_ALIGN_C_AXIS_help) self.gcode.register_command( 'SAVE_C_AXIS_POINT', self.cmd_SAVE_C_AXIS_POINT, desc=self.cmd_SAVE_C_AXIS_POINT_help) + cmd_SAVE_C_AXIS_POINT_help = "Save point for C axis align" + def cmd_SAVE_C_AXIS_POINT(self, gcmd): point_idx = gcmd.get_int('POINT', 0) coords = gcmd.get('COORDS', None) @@ -39,7 +43,18 @@ def cmd_SAVE_C_AXIS_POINT(self, gcmd): for axis, coord in enumerate(coords): self.point_coords[point_idx][axis] = coord - cmd_SAVE_C_AXIS_POINT_help = "Save point for C axis align" + cmd_ALIGN_C_AXIS_help = "Calculate and apply correction for align the C axis" + + def cmd_ALIGN_C_AXIS(self, gcmd): + for i in range(self.max_repeat_probe): + 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: + logging.info("align the axis C completed") + break + else: + self._apply_offset_c(offset) def _calc_c_axis_align(self, point_0, point_1): offset = math.atan((point_1[1] - point_0[1]) / 90) * RAD_TO_DEG / 3 @@ -47,25 +62,13 @@ def _calc_c_axis_align(self, point_0, point_1): return offset def _apply_offset_c(self, offset): + logging.info("an offset has been applied to correct the C axis") align_gcmd = self.gcode.create_gcode_command( 'G0', 'G0', {'C': offset}) self.gcode_move.cmd_G1(align_gcmd) self.gcode_move.cmd_G92(self.gcode.create_gcode_command( 'G92', 'G92', {'C': 0})) - def cmd_ALIGN_C_AXIS(self, gcmd): - for i in range(self.max_repeat_probe): - 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: - break - else: - self._apply_offset_a(offset) - - - cmd_ALIGN_C_AXIS_help = "Calculate C axis align" - def load_config(config): CAxisAlignCalculation(config) diff --git a/stereotech_config/calibrate/probe_5d_template.cfg b/stereotech_config/calibrate/probe_5d_template.cfg index 1446dd274c25..f3779d745581 100644 --- a/stereotech_config/calibrate/probe_5d_template.cfg +++ b/stereotech_config/calibrate/probe_5d_template.cfg @@ -32,7 +32,7 @@ gcode: SET_GCODE_VARIABLE MACRO=PROBE_TEMPLATE_POINT VARIABLE={"a_" ~ v ~"probe_z"} VALUE={printer.probe.last_result[2] - printer.gcode_move.homing_origin.z} [gcode_macro MOVE_ALIGN_C_AXIS] -description: align template along axis x +description: moves for align template along axis X gcode: PROBE_TEMPLATE_POINT POINT=D_Y SET_POINT MACRO=SAVE_C_AXIS_POINT POINT=1 From 3cf6521df07b64be8fab2e5ca4855f55a54f9d97 Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Wed, 7 Feb 2024 13:32:49 +0000 Subject: [PATCH 5/8] STEAPP-899: added check the command ABORT is exist (fix bug 911: Unknown command: ABORT) --- stereotech_config/common/homing_macros.cfg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stereotech_config/common/homing_macros.cfg b/stereotech_config/common/homing_macros.cfg index f4c61e57dc40..739f995475c1 100644 --- a/stereotech_config/common/homing_macros.cfg +++ b/stereotech_config/common/homing_macros.cfg @@ -41,7 +41,9 @@ gcode: SAVE_VARIABLES SAVE_STATE_MODULE {% else %} - ABORT + {% if (printer.manual_probe and printer.manual_probe.is_active) or (printer.bed_screws and printer.bed_screws.is_active) %} + ABORT + {% endif %} {% endif %} {% if printer.probe %} CANCEL_TEST_PROBE From cc5b4b89c1e369e46b09f91584afdcd5a8af4329 Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Thu, 8 Feb 2024 06:48:16 +0000 Subject: [PATCH 6/8] deleted the unneeded files --- stereotech_config/750/probe_main.cfg | 988 --------------------------- stereotech_config/750/probe_v3.cfg | 131 ---- 2 files changed, 1119 deletions(-) delete mode 100644 stereotech_config/750/probe_main.cfg delete mode 100644 stereotech_config/750/probe_v3.cfg diff --git a/stereotech_config/750/probe_main.cfg b/stereotech_config/750/probe_main.cfg deleted file mode 100644 index 26ca7a80801d..000000000000 --- a/stereotech_config/750/probe_main.cfg +++ /dev/null @@ -1,988 +0,0 @@ -[probe] -pin: !manta_mcu:probe_pin -samples: 4 -samples_tolerance_retries: 1 -samples_result: median -lift_speed: 10.0 - -[bed_mesh] -speed: 120 -horizontal_move_z: 180 -mesh_min: 120, 10 -mesh_max: 480, 530 -probe_count: 6, 6 -fade_start: 1 -fade_end: 10 -fade_target: 0 -algorithm: bicubic -mesh_pps: 1, 1 - -[bed_mesh module_3d] -version = 1 -points = - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 -x_count = 6 -y_count = 6 -mesh_x_pps = 1 -mesh_y_pps = 1 -algo = bicubic -tension = 0.2 -min_x = 120.0 -max_x = 480.0 -min_y = 10.0 -max_y = 530.0 - -[skew_correction] - -[b_axis_compensation] - -[c_axis_align] - -[auto_wcs] - -[skew_correction module_3d] -xy_skew = 0.0 -xz_skew = 0.0 -yz_skew = 0.0 - -[skew_correction module_5d] -xy_skew = 0.0 -xz_skew = 0.0 -yz_skew = 0.0 - -[gcode_macro TEST_PROBE] -gcode: - QUERY_PROBE - UPDATE_DELAYED_GCODE ID=test_probe_loop DURATION=1.0 - -[gcode_macro CANCEL_TEST_PROBE] -gcode: - UPDATE_DELAYED_GCODE ID=test_probe_loop DURATION=0.0 - {action_respond_info('Abort check loop')} - -[delayed_gcode test_probe_loop] -gcode: - {% if printer["probe"].last_query %} - UPDATE_DELAYED_GCODE ID=test_probe_loop DURATION=0.0 - {action_respond_info('Probe pressed, abort check loop')} - {% else %} - {action_respond_info('Probe not pressed')} - QUERY_PROBE - UPDATE_DELAYED_GCODE ID=test_probe_loop DURATION=1.0 - {% endif %} - -[gcode_macro CALIBRATE_MODULE_THREE_D] -description: 3D module calibration -gcode: - {% if printer["gcode_button five_axis_module"].state == "RELEASED" %} - {% set axis_max = printer.toolhead.axis_maximum %} - {% set offsets = printer.probe.offsets %} - {% set center_probe_x = (axis_max[0] / 2.0) - offsets[0] %} - {% set center_probe_y = (axis_max[1] / 2.0) - offsets[1] %} - G0 X{center_probe_x} Y{center_probe_y} F6000 - G0 Z40 F3600 - PROBE - G91 - G0 Z30 F3600 - G90 - MODULE_THREE_D_MESH_CALIBRATE - G91 - G0 Z30 F3600 - G90 - G0 X{center_probe_x} Y50 F3600 - {% endif %} - -[gcode_macro MODULE_THREE_D_MESH_CALIBRATE] -description: 3D module calibration -gcode: - {% if printer["gcode_button five_axis_module"].state == "RELEASED" %} - Z_OFFSET_APPLY_PROBE Z={printer.probe.last_result[2]} - BED_MESH_CALIBRATE PROFILE=module_3d - BED_MESH_CLEAR - {% endif %} - -[gcode_macro SET_C_ALIGN_POINT] -gcode: - {% set point = printer.probe.last_result %} - {% set offsets = printer.probe.offsets %} - {% set x = point[0] + offsets[0] - printer.gcode_move.homing_origin.x %} - {% set y = point[1] + offsets[1] - printer.gcode_move.homing_origin.y %} - {% set z = point[2] - offsets[2] - printer.gcode_move.homing_origin.z %} - {% set index = params.POINT|default(0) %} - SAVE_C_AXIS_POINT POINT={index} COORDS='{x},{y},{z}' - -[gcode_macro SET_A_OFFSET_POINT] -gcode: - {% set point = printer.probe.last_result %} - {% set offsets = printer.probe.offsets %} - {% set x = point[0] + offsets[0] - printer.gcode_move.homing_origin.x %} - {% set y = point[1] + offsets[1] - printer.gcode_move.homing_origin.y %} - {% set z = point[2] - offsets[2] - printer.gcode_move.homing_origin.z %} - {% set index = params.POINT|default(0) %} - SAVE_A_AXIS_POINT POINT={index} COORDS='{x},{y},{z}' - -[gcode_macro SET_B_COMPENSATION_POINT] -gcode: - {% set point = printer.probe.last_result %} - {% set offsets = printer.probe.offsets %} - {% set x = point[0] + offsets[0] - printer.gcode_move.homing_origin.x %} - {% set y = point[1] + offsets[1] - printer.gcode_move.homing_origin.y %} - {% set z = point[2] - offsets[2] - printer.gcode_move.homing_origin.z %} - {% set index = params.POINT|default(0) %} - SAVE_B_AXIS_POINT POINT={index} COORDS='{x},{y},{z}' - -[gcode_macro SET_SKEW_COMPENSATION_POINT] -description: saved value about probe for align skew -gcode: - {% set point = printer.probe.last_result %} - {% set offsets = printer.probe.offsets %} - {% set x = point[0] + offsets[0] - printer.gcode_move.homing_origin.x %} - {% set y = point[1] + offsets[1] - printer.gcode_move.homing_origin.y %} - {% set z = point[2] - offsets[2] - printer.gcode_move.homing_origin.z %} - {% set index = params.POINT|default(0) %} - SAVE_SKEW_POINT POINT={index} COORDS='{x},{y},{z}' - -[gcode_macro SET_AUTO_WCS_POINT] -gcode: - {% set point = printer.probe.last_result %} - {% set offsets = printer.probe.offsets %} - {% set x = point[0] + offsets[0] - printer.gcode_move.homing_origin.x %} - {% set y = point[1] + offsets[1] - printer.gcode_move.homing_origin.y %} - {% set z = point[2] - offsets[2] - printer.gcode_move.homing_origin.z %} - # checking the axes that they are within the allowable range - {% set home_min = printer.toolhead.axis_minimum %} - {% set home_max = printer.toolhead.axis_maximum %} - {% if x < home_min[0] or x > home_max[0] %} - {action_raise_error('201: axis x=%f out of range (%f - %f)' % (x, home_min[0], home_max[0]))} - {% elif y < home_min[1] or y > home_max[1] %} - {action_raise_error('202: axis y=%f out of range (%f - %f)' % (y, home_min[1], home_max[1]))} - {% elif z < home_min[2] or z > home_max[2] %} - {action_raise_error('203: axis z=%f out of range (%f - %f)' % (z, home_min[2], home_max[2]))} - {% endif %} - {% set index = params.POINT|default(0) %} - SAVE_WCS_CALC_POINT POINT={index} COORDS='{x},{y},{z}' - -[gcode_macro ADJUST_TEMPLATE_HEIGHT] -gcode: - {% set wcs = params.WCS|default(1)|int %} - PROBE_TEMPLATE_POINT POINT={"O_" ~ wcs} - SET_TEMPLATE_HEIGHT WCS={wcs} - -[gcode_macro SET_TEMPLATE_HEIGHT] -gcode: - {% set wcs = params.WCS|default(1)|int %} - SET_GCODE_VARIABLE MACRO=PROBE_TEMPLATE_POINT VARIABLE={"wcs" ~ wcs ~"_probe_z"} VALUE={printer.probe.last_result[2] - printer.gcode_move.homing_origin.z} - -[gcode_macro MOVE_TO_AUTO_WCS] -gcode: - {% set set_xy = params.XY|default(0) %} - {% set y_shift = 50 if set_xy else 7 %} - ; make a check to avoid collision of the sensor and the template - {% if y_shift == 7 and printer["gcode_macro CONSTANTS"].offsets_sensor[1]|float > -15.0 %} - {% set y_shift = y_shift + 15 %} - {% endif %} - {% if printer["gcode_button five_axis_module"].state == "PRESSED" %} - G0 X{printer.auto_wcs.wcs[0][0]} Y{printer.auto_wcs.wcs[0][1] - y_shift} Z{printer.auto_wcs.wcs[0][2] + 10} F3600 - {% endif %} - -[gcode_macro ADJUST_PROBE_OFFSET_Z] -gcode: - {% if printer["gcode_button five_axis_module"].state == "PRESSED" %} - {% set wcs_0 = printer.auto_wcs.wcs[0] %} - {% set wcs_1 = printer.auto_wcs.wcs[1] %} - {% set offsets = printer.probe.offsets %} - {% set coord_z = printer.gcode_move.position.z - printer.gcode_move.homing_origin.z %} - {% set delta_z = wcs_0[2] - coord_z %} - Z_OFFSET_APPLY_PROBE Z={(offsets[2] + delta_z)|abs} - {% if params.ADJUST_CALIBRATION|default(0) %} - {% set b_axis_params = printer.b_axis_compensation %} - B_AXIS_COMPENSATION_VARS Z={b_axis_params.rot_center_z - delta_z} - {% endif %} - {% if params.ADJUST_WCS|default(0) %} - {% set auto_wcs_params = printer.auto_wcs.wcs %} - {% set x0 = auto_wcs_params[0][0] %} - {% set y0 = auto_wcs_params[0][1] %} - {% set z0 = auto_wcs_params[0][2] - delta_z %} - SET_AUTO_WCS WCS=0 COORDS='{x0},{y0},{z0}' - {% set x1 = auto_wcs_params[1][0] %} - {% set y1 = auto_wcs_params[1][1] %} - {% set z1 = auto_wcs_params[1][2] - delta_z %} - SET_AUTO_WCS WCS=1 COORDS='{x1},{y1},{z1}' - {% endif %} - {% endif %} - -[gcode_macro ADJUST_PROBE_OFFSET_XY] -gcode: - {% if printer["gcode_button five_axis_module"].state == "PRESSED" %} - {% set y_shift = 50 %} - {% set wcs_0 = printer.auto_wcs.wcs[0] %} - {% set wcs_1 = printer.auto_wcs.wcs[1] %} - {% set offsets = printer.probe.offsets %} - {% set coord_x = printer.gcode_move.position.x - printer.gcode_move.homing_origin.x %} - {% set coord_y = printer.gcode_move.position.y + y_shift - printer.gcode_move.homing_origin.y %} - {% set delta_x = wcs_0[0] - coord_x %} - {% set delta_y = wcs_0[1] - coord_y %} - # edit offset between nozzle and probe_sensor - Z_OFFSET_APPLY_PROBE X={offsets[0] - delta_x} Y={offsets[1] - delta_y} - # set b_compensation vars - {% if params.ADJUST_CALIBRATION|default(0) %} - {% set b_axis_params = printer.b_axis_compensation %} - B_AXIS_COMPENSATION_VARS X={b_axis_params.rot_center_x - delta_x} - {% endif %} - # edit wcs in auto_wcs module from the new offsets - {% if params.ADJUST_WCS|default(0) %} - {% set auto_wcs_params = printer.auto_wcs.wcs %} - {% set x0 = auto_wcs_params[0][0] - delta_x %} - {% set y0 = auto_wcs_params[0][1] - delta_y %} - {% set z0 = auto_wcs_params[0][2] %} - SET_AUTO_WCS WCS=0 COORDS='{x0},{y0},{z0}' - {% set x1 = auto_wcs_params[1][0] - delta_x %} - {% set y1 = auto_wcs_params[1][1] - delta_y %} - {% set z1 = auto_wcs_params[1][2] %} - SET_AUTO_WCS WCS=1 COORDS='{x1},{y1},{z1}' - {% endif %} - {% endif %} - -[gcode_macro SET_WCS_FROM_AUTO_WCS] -gcode: - {% set auto_wcs_params = printer.auto_wcs.wcs %} - {% set max_x = printer.toolhead.axis_maximum[0]|float %} - {% set max_z = printer.toolhead.axis_maximum[2]|float %} - G10 L2 P2 X{auto_wcs_params[0][0]} Y{auto_wcs_params[0][1]} Z{auto_wcs_params[0][2]} - G10 L2 P4 X{auto_wcs_params[0][0]} Y{auto_wcs_params[0][1]} Z{auto_wcs_params[0][2]} - G10 L2 P3 X{auto_wcs_params[1][0]} Y{auto_wcs_params[1][1]} Z{auto_wcs_params[1][2]} - G10 L2 P5 X{auto_wcs_params[1][0]} Y{auto_wcs_params[1][1]} Z{auto_wcs_params[1][2]} - G90 - G0 Z{max_z / 2.0} F3600 - G54 - G0 X{max_x / 2.0} Y50 F3600 - -[gcode_macro AUTO_BASEMENT_WCS_MOVE] -description: This macro does a move for measuring wcs_1_z and wcs_2_y-raw mode FULL wcs_2_y and wcs_1_z-raw mode SPIRAL. -gcode: - {% set wcs = params.WCS|default(0)|int %} - {% set offsets = printer.probe.offsets %} - {% set wcs_offsets = printer.gcode_move.wcs_offsets[wcs + 3] %} - {% set x = wcs_offsets[0] - offsets[0] %} - {% set y = wcs_offsets[1] - offsets[1] %} - {% set z = wcs_offsets[2] + offsets[2] %} - {% set max_z = printer.toolhead.axis_maximum[2]|float %} - {% set a = '0' if wcs == 0 else '90' %} - G28 A - G0 A{a} F3600 - G0 Z{max_z / 2.0} F3600 - G0 X{x} Y{y} F3600 - -[gcode_macro CHECK_AXIS_A] -description: This macro moves, measures the a-axis, and gets the difference between the two measuring points and apply offset. -gcode: - PROBE_TOOL_POINT POINT=Z_2_0 WCS=2 - SET_A_OFFSET_POINT POINT=1 - PROBE_TOOL_POINT POINT=Z_2_1 WCS=2 - SET_A_OFFSET_POINT POINT=0 - PROBE_TOOL_POINT POINT=Z_2_2 WCS=2 - SET_A_OFFSET_POINT POINT=3 - PROBE_TOOL_POINT POINT=Z_2_3 WCS=2 - SET_A_OFFSET_POINT POINT=2 - ; calculate and apply offset for axis A - CALC_A_AXIS_OFFSET_TOOL - -[gcode_macro GET_TOOL_LENGTH] -description: This macro calculate length tool. -variable_tool_length: 0.0 -gcode: - {% set old_y = printer.gcode_move.wcs_offsets[4][1] %} - {% set template_thickness = 10.0 %} - {% set wcs_2_y = printer.gcode_move.wcs_offsets[2][1] %} - {% set tool_length = old_y + template_thickness - wcs_2_y %} - SET_GCODE_VARIABLE MACRO=GET_TOOL_LENGTH VARIABLE=tool_length VALUE={tool_length} - {action_respond_info('tool length=%s' % tool_length)} - -[gcode_macro TOOL_RADIUS] -description: moved to measure tool radius and calculate it. -gcode: - {% set mode = params.MODE %} - {% if mode == 'full' %} - PROBE_TOOL_POINT POINT=Y_1 WCS=1 - SET_AUTO_WCS_POINT POINT=0 - GET_RADIUS_TOOLING ROUGH=1 MODE={mode} - PROBE_TOOL_POINT POINT=X_1_0 WCS=1 - SET_AUTO_WCS_POINT POINT=1 - PROBE_TOOL_POINT POINT=X_1_1 WCS=1 - SET_AUTO_WCS_POINT POINT=2 - GET_RADIUS_TOOLING MODE={mode} - {% elif mode == 'spiral' %} - PROBE_TOOL_POINT POINT=Z_2_0 WCS=2 - SET_AUTO_WCS_POINT POINT=0 - PROBE_TOOL_POINT POINT=X_2_0 WCS=2 - SET_AUTO_WCS_POINT POINT=1 - PROBE_TOOL_POINT POINT=X_2_1 WCS=2 - SET_AUTO_WCS_POINT POINT=2 - GET_RADIUS_TOOLING MODE={mode} - {% endif %} - -[gcode_macro MOVE_ACCURACY_SET_MODULE_FIVE_D] -Description: This macro do moved for accuracy set the module 5d. -gcode: - G28 A - M204 S500 - G0 C0.1 - G0 C0 - ADJUST_TEMPLATE_HEIGHT WCS=1 - - PROBE_TEMPLATE_POINT POINT=AY - SET_C_ALIGN_POINT POINT=0 - PROBE_TEMPLATE_POINT POINT=BY - SET_C_ALIGN_POINT POINT=1 - CALC_C_AXIS_ALIGN - - PROBE_TEMPLATE_POINT POINT=O_1 - SET_A_OFFSET_POINT POINT=0 - PROBE_TEMPLATE_POINT POINT=CZ - SET_A_OFFSET_POINT POINT=1 - CALC_A_AXIS_OFFSET - - PROBE_TEMPLATE_POINT POINT=AZ - SET_SKEW_COMPENSATION_POINT POINT=0 - PROBE_TEMPLATE_POINT POINT=BZ - SET_SKEW_COMPENSATION_POINT POINT=1 - PROBE_TEMPLATE_POINT POINT=YZ2 - SET_SKEW_COMPENSATION_POINT POINT=2 - PROBE_TEMPLATE_POINT POINT=YZ3 - SET_SKEW_COMPENSATION_POINT POINT=3 - CHECK_ACCURACY_SET_MODULE_FIVE_D - -[gcode_macro CHECK_SKEW_TOOL] -description: This macro calculates the x-axis skew between four points using the average. -gcode: - {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].tool_length|float %} - {% if printer["gcode_macro SETTINGS_MEASURE_SKEW"].measure_skew|int %} - CALC_SKEW_COMPENSATION_WCS FACTOR=XY - CALC_SKEW_COMPENSATION_WCS FACTOR=XZ - CALC_SKEW_COMPENSATION_WCS FACTOR=YZ - SKEW_PROFILE SAVE=module_5d - {% if tool_length > 50.0 %} - {% set max_z = printer.toolhead.axis_maximum[2]|float %} - G0 Z{max_z / 2.0} F3600 - PROBE_TOOL_POINT POINT=X_2_0 WCS=2 - SET_SKEW_COMPENSATION_POINT POINT=2 - PROBE_TOOL_POINT POINT=X_2_2 WCS=2 - SET_SKEW_COMPENSATION_POINT POINT=0 - PROBE_TOOL_POINT POINT=X_2_4 WCS=2 - SET_SKEW_COMPENSATION_POINT POINT=3 - PROBE_TOOL_POINT POINT=X_2_5 WCS=2 - SET_SKEW_COMPENSATION_POINT POINT=1 - CALC_SKEW_COMPENSATION FACTOR=XY MSG=skew_calculate_by_tool - SKEW_PROFILE SAVE=module_5d - {% else %} - {action_respond_info('Warning, tool length less 50mm for calculate skew for the axis X, where use only wcs_2 points!')} - {% endif %} - {% else %} - {action_respond_info('Skew compensation measurement disabled.')} - {% endif %} - -[gcode_macro SET_ECCENTRICITY] -Description: This macro save eccentricity for wcs_1. -gcode: - {% set x1 = params.X1|default(0.0)|float %} - {% set x2 = params.X2|default(0.0)|float %} - {% set y1 = params.Y1|default(0.0)|float %} - {% set y2 = params.Y2|default(0.0)|float %} - {% set offset_x = (x2 - x1) / 2 %} - {% set offset_y = (y1 - y2) / 2 %} - SAVE_VARIABLE VARIABLE=eccentricity_offset_x VALUE={offset_x} - SAVE_VARIABLE VARIABLE=eccentricity_offset_y VALUE={offset_y} - {action_respond_info('offset_x=%.3f; offset_y=%.3f for correcting ECCENTRICITY saved! Please use calibrate mode "auto calibrate the start point" for apply this params.' % (offset_x, offset_y))} - -[gcode_macro APPLY_ECCENTRICITY] -Description: This macro apply eccentricity correction for wcs_1. -gcode: - {% set svv = printer.save_variables.variables %} - {% set offset_x = svv.eccentricity_offset_x|default(0.0)|float %} - {% set offset_y = svv.eccentricity_offset_y|default(0.0)|float %} - {% set old_x = printer.gcode_move.wcs_offsets[1][0] %} - {% set old_y = printer.gcode_move.wcs_offsets[1][1] %} - {% set new_x = old_x + offset_x %} - {% set new_y = old_y + offset_y %} - G10 L2 P2 R1 X{offset_x} - G10 L2 P2 R1 Y{offset_y} - SAVE_VARIABLES - {action_respond_info('Applied offset for corrective eccentricity.\noffset_x=%.3f; offset_y=%.3f. Old wcs_1_x=%.3f, wcs_1_y=%.3f. New wcs_1_x=%.3f, wcs_1_y=%.3f' % (offset_x, offset_y, old_x, old_y, new_x, new_y))} - -[gcode_macro CALIBRATE_MODULE_FIVE_D] -description: macro for get first point to auto calibrate 5d and align teamplate -gcode: - {% if printer["gcode_button five_axis_module"].state == "PRESSED" %} - G28 A - M204 S500 - G0 C0.1 - G0 C0 - ; get axis Z for the wcs_probe_1 - ADJUST_TEMPLATE_HEIGHT WCS=1 - ; aligning template, axis C - PROBE_TEMPLATE_POINT POINT=AY - SET_C_ALIGN_POINT POINT=0 - PROBE_TEMPLATE_POINT POINT=BY - SET_C_ALIGN_POINT POINT=1 - CALC_C_AXIS_ALIGN - PROBE_TEMPLATE_POINT POINT=AY - SET_C_ALIGN_POINT POINT=0 - PROBE_TEMPLATE_POINT POINT=BY - SET_C_ALIGN_POINT POINT=1 - CALC_C_AXIS_ALIGN - ; aligning template, axis A - PROBE_TEMPLATE_POINT POINT=O_1 - SET_A_OFFSET_POINT POINT=0 - PROBE_TEMPLATE_POINT POINT=CZ - SET_A_OFFSET_POINT POINT=1 - CALC_A_AXIS_OFFSET - PROBE_TEMPLATE_POINT POINT=O_1 - SET_A_OFFSET_POINT POINT=0 - PROBE_TEMPLATE_POINT POINT=CZ - SET_A_OFFSET_POINT POINT=1 - CALC_A_AXIS_OFFSET - - ; checked accuracy set the module 5d. - ;MOVE_ACCURACY_SET_MODULE_FIVE_D - - CHECK_SENSOR_VERSION_AND_START_AUTOCALIBRATE - M204 S1500 - {% endif %} - -[gcode_macro MOVE_AUTOCALIBRATE_FULL_V_2] -description: macro do move for measuring and calculated WCS for FULL-SPIRALL mode. Sensor DAC_v_2 -gcode: - {% set max_z = printer.toolhead.axis_maximum[2]|float %} - ; move for measuring wcs_1_z - PROBE_TOOL_POINT POINT=Z_1 WCS=3 - ; set wcs_1_z, wcs_2_y(raw) - ADJUST_BASEMENT_WCS WCS=2 - ; get tool length - GET_TOOL_LENGTH - ; moving for measure radius the tool - TOOL_RADIUS MODE=full - ; checking and apply offset for axis A - CHECK_AXIS_A - CHECK_AXIS_A - G0 Z{max_z / 2.0} F3600 - ; move for measuring the wcs_1_x - PROBE_TOOL_POINT POINT=X_1_0 WCS=1 - SET_AUTO_WCS_POINT POINT=0 - PROBE_TOOL_POINT POINT=X_1_1 WCS=1 - SET_AUTO_WCS_POINT POINT=1 - CALC_WCS_TOOL WCS=1 AXIS=0 - ; set wcs_1_x - ADJUST_BASEMENT_WCS WCS=4 - ; move for measuring the wcs_1_y - PROBE_TOOL_POINT POINT=Y_1_0 WCS=1 - SET_AUTO_WCS_POINT POINT=0 - PROBE_TOOL_POINT POINT=Y_1_1 WCS=1 - SET_AUTO_WCS_POINT POINT=1 - CALC_WCS_TOOL WCS=1 AXIS=1 - ; set wcs_1_y - ADJUST_BASEMENT_WCS WCS=5 - ; move for measuring the wcs_2_y - PROBE_TOOL_POINT POINT=Y_2 WCS=2 - ; set wcs_2_y - ADJUST_BASEMENT_WCS WCS=3 - ; move for measuring the wcs_2_x - PROBE_TOOL_POINT POINT=X_2_0 WCS=2 - SET_AUTO_WCS_POINT POINT=0 - PROBE_TOOL_POINT POINT=X_2_1 WCS=2 - SET_AUTO_WCS_POINT POINT=1 - CALC_WCS_TOOL WCS=2 AXIS=0 - ; set wcs_2_x - ADJUST_BASEMENT_WCS WCS=6 - ; eccentricity correction - APPLY_ECCENTRICITY - ; check skew axis X - CHECK_SKEW_TOOL - ; move for measuring the wcs_2_z - PROBE_TOOL_POINT POINT=Z_2_0 WCS=2 - -[gcode_macro MOVE_AUTOCALIBRATE_SPIRAL_V_2] -description: macro do move for measuring and calculated WCS for SPIRALL mode. Sensor DAC_v_2 -gcode: - {% set max_z = printer.toolhead.axis_maximum[2]|float %} - ; move for measuring wcs_2_y - PROBE - G0 Z{max_z / 2.0} F3600 - ; set wcs_2_y and wcs_1_z(row) - ADJUST_BASEMENT_WCS WCS=7 - ; calculate rough radius - SET_AUTO_WCS_POINT POINT=0 - GET_RADIUS_TOOLING ROUGH=1 MODE=spiral - ; get tool length - GET_TOOL_LENGTH - ; move to calculate wcs by tool - MOVE_MEASHURING_SPIRAL - -[gcode_macro MOVE_MEASHURING_SPIRAL] -description: This macro do move and calculate wcs for SPIRAL mode. -gcode: - {% set wcs = params.WCS %} - {% set radius = printer.auto_wcs.tooling_radius %} - {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].tool_length|float %} - {% if radius < 5.0 and tool_length > 35.0 %} - ; checking and apply offset for axis A - CHECK_AXIS_A - CHECK_AXIS_A - ; moving for measure radius the tool - TOOL_RADIUS MODE=spiral - ; move for measuring the wcs_2_x - PROBE_TOOL_POINT POINT=X_2_0 WCS=2 - SET_AUTO_WCS_POINT POINT=0 - PROBE_TOOL_POINT POINT=X_2_1 WCS=2 - SET_AUTO_WCS_POINT POINT=1 - CALC_WCS_TOOL WCS=2 AXIS=0 - ; set wcs_2_x - ADJUST_BASEMENT_WCS WCS=6 - ; check skew axes - CHECK_SKEW_TOOL - ; move for measuring the wcs_2_z - PROBE_TOOL_POINT POINT=Z_2_0 WCS=2 - {% else %} - {action_respond_info("Radius greater than 5 mm or tool length less 35mm, movement to calculate wcs by tool is not available. Wcs will be calculated from the template.")} - {% endif %} - -[gcode_macro PROBE_TEMPLATE_POINT] -description: Macro for calibration template probing -variable_wcs1_probe_z: 120.0 -variable_wcs2_probe_z: 120.0 -gcode: - {% set point = params.POINT|default('O_1') %} - {% set offsets = printer['probe'].offsets %} - {% set wcs1 = printer["gcode_macro CONSTANTS"].probe_a_horizontal %} - {% set wcs2 = printer["gcode_macro CONSTANTS"].probe_a_vertical %} - {% set wcs_probe_1 = [wcs1[0] - offsets[0], wcs1[1] - offsets[1], wcs1[2] + offsets[2]] %} - {% set wcs_probe_2 = [wcs2[0] - offsets[0], wcs2[1] - offsets[1], wcs2[2] + offsets[2]] %} - {% set max_y = printer.toolhead.axis_maximum[1]|float %} - {% if wcs_probe_1[1] > (max_y - 6.0) %} - {% set wcs_probe_1 = [wcs1[0] - offsets[0], max_y - 6.0, wcs1[2]] %} - {% endif %} - G0 Z{wcs_probe_2[2] + 30} F3600 - G0 A0 C0 F3600 - {% set target_x = wcs_probe_1[0] %} - {% set target_y = wcs_probe_1[1] %} - {% set target_z = wcs_probe_1[2] %} - {% set axis = 'Z' %} - {% set positive = 0 %} - {% if point=='O_1' %} - {% set target_y = wcs_probe_1[1] - 4 %} - {% set target_z = wcs_probe_1[2] + 30 %} - {% elif point=='O_2' %} - {% set target_x = wcs_probe_2[0] %} - {% set target_y = wcs_probe_2[1] %} - {% set target_z = wcs_probe_2[2] + 30 %} - G0 A90 C60 F3600 - {% elif point=='AY' %} - {% set target_x = wcs_probe_1[0] - 45 %} - {% set target_y = wcs_probe_1[1] - 35 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'Y' %} - {% set positive = 1 %} - {% elif point=='AY1' %} - {% set target_x = wcs_probe_1[0] - 32 %} - {% set target_y = wcs_probe_1[1] - 83 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'Y' %} - {% set positive = 1 %} - G0 C15 F3600 - {% elif point=='AY1_2' %} - {% set target_x = wcs_probe_1[0] - 32 %} - {% set target_y = wcs_probe_1[1] - 16 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'Y' %} - {% set positive = 1 %} - G0 C30 F3600 - {% elif point=='AY2' %} - {% set target_x = wcs_probe_1[0] - 32 %} - {% set target_y = wcs_probe_1[1] - 6 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'Y' %} - G0 C15 F3600 - {% elif point=='AY2_2' %} - {% set target_x = wcs_probe_1[0] - 32 %} - {% set target_y = wcs_probe_1[1] + 12 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'Y' %} - G0 C30 F3600 - {% elif point=='BY' %} - {% set target_x = wcs_probe_1[0] + 45 %} - {% set target_y = wcs_probe_1[1] - 35 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'Y' %} - {% set positive = 1 %} - {% elif point=='CY' %} - {% set target_x = wcs_probe_1[0] %} - {% set target_y = wcs_probe_1[1] - 90 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'Y' %} - {% set positive = 1 %} - {% elif point=='DY_1' %} - {% set target_x = wcs_probe_2[0] + 5 %} - {% set target_y = wcs_probe_2[1] - 20 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z - 10 %} - {% set axis = 'Y' %} - {% set positive = 1 %} - G0 A90 C30 F3600 - {% elif point=='EY_1' %} - {% set target_x = wcs_probe_2[0] + 5 %} - {% set target_y = wcs_probe_2[1] + 18 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z - 10 %} - {% set axis = 'Y' %} - G0 A90 C30 F3600 - {% elif point=='DY_2' %} - {% set target_x = wcs_probe_2[0] + 5 %} - {% set target_y = wcs_probe_2[1] - 20 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z - 10 %} - {% set axis = 'Y' %} - {% set positive = 1 %} - G0 A90 C30 F3600 - {% elif point=='EY_2' %} - {% set target_x = wcs_probe_2[0] + 5 %} - {% set target_y = wcs_probe_2[1] + 20 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z - 10 %} - {% set axis = 'Y' %} - G0 A90 C30 F3600 - {% elif point=='AZ' %} - {% set target_x = wcs_probe_1[0] - 45 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z + 10 %} - {% elif point=='BZ' %} - {% set target_x = wcs_probe_1[0] + 45 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z + 10 %} - {% elif point=='CZ' %} - {% set target_y = wcs_probe_1[1] - 55 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z + 10 %} - {% elif point=='CZ1' %} - {% set target_y = wcs_probe_1[1] - 45 %} - G0 A10 F3600 - {% elif point=='EZ' %} - {% set target_x = wcs_probe_2[0] %} - {% set target_y = wcs_probe_2[1] %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z - 10 %} - G0 A90 F3600 - {% elif point=='DZ' %} - {% set target_x = wcs_probe_2[0] %} - {% set target_y = wcs_probe_2[1] %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z + 10 %} - G0 A90 C30 F3600 - {% elif point=='DZ_2' %} - {% set target_x = wcs_probe_2[0] %} - {% set target_y = wcs_probe_2[1] %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z - 10 %} - G0 A90 F3600 - {% elif point=='AX' %} - {% set target_x = wcs_probe_1[0] - 80 %} - {% set target_y = wcs_probe_1[1] - 4 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'X' %} - {% set positive = 1 %} - {% elif point=='AX1' %} - {% set target_x = wcs_probe_1[0] - 40 %} - {% set target_y = wcs_probe_1[1] - 45 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'X' %} - {% set positive = 1 %} - {% elif point=='AX2' %} - {% set target_x = wcs_probe_1[0] - 80 %} - {% set target_y = wcs_probe_1[1] + 2 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'X' %} - {% set positive = 1 %} - {% elif point=='AX3' %} - {% set target_x = wcs_probe_1[0] - 20 %} - {% set target_y = wcs_probe_1[1] - 50 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'X' %} - {% set positive = 1 %} - {% elif point=='BX' %} - {% set target_x = wcs_probe_1[0] + 80 %} - {% set target_y = wcs_probe_1[1] - 4 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'X' %} - {% elif point=='BX1' %} - {% set target_x = wcs_probe_1[0] + 80 %} - {% set target_y = wcs_probe_1[1] - 2 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'X' %} - {% elif point=='BX2' %} - {% set target_x = wcs_probe_1[0] + 80 %} - {% set target_y = wcs_probe_1[1] + 2 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'X' %} - {% elif point=='BX3' %} - {% set target_x = wcs_probe_1[0] + 20 %} - {% set target_y = wcs_probe_1[1] - 50 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'X' %} - ; skew_correction - ; xy skew - {% elif point=='XY1' %} - {% set target_x = wcs_probe_1[0] + 15 %} - {% set target_y = wcs_probe_1[1] - 50 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'X' %} - {% elif point=='XY2' %} - {% set target_x = wcs_probe_1[0] - 15 %} - {% set target_y = wcs_probe_1[1] - 50 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'X' %} - {% set positive = 1 %} - ; xz skew - {% elif point=='XZ1' %} - {% set target_x = wcs_probe_1[0] + 80 %} - {% set target_y = wcs_probe_1[1] - 5 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'X' %} - {% elif point=='XZ2' %} - {% set target_x = wcs_probe_1[0] - 80 %} - {% set target_y = wcs_probe_1[1] - 5 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs1_probe_z - 6 %} - {% set axis = 'X' %} - {% set positive = 1 %} - {% elif point=='XZ3' %} - {% set target_x = wcs_probe_2[0] + 25 %} - {% set target_y = wcs_probe_2[1] %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z - 5 %} - {% set axis = 'X' %} - G0 A90 C60 - {% elif point=='XZ4' %} - {% set target_x = wcs_probe_2[0] - 25 %} - {% set target_y = wcs_probe_2[1] %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z - 5 %} - {% set axis = 'X' %} - {% set positive = 1 %} - G0 A90 C60 F3600 - ; yz skew - {% elif point=='YZ1' %} - {% set target_x = wcs_probe_2[0] %} - {% set target_y = wcs_probe_2[1] - 30 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z - 5 %} - {% set axis = 'Y' %} - {% set positive = 1 %} - G0 A90 C60 F3600 - {% elif point=='YZ2' %} - {% set target_x = wcs_probe_2[0] - 45 %} - {% set target_y = wcs_probe_2[1] - 30 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z - 42 %} - {% set axis = 'Y' %} - {% set positive = 1 %} - G0 A90 C5 F3600 - {% elif point=='YZ3' %} - {% set target_x = wcs_probe_2[0] + 45 %} - {% set target_y = wcs_probe_2[1] - 30 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z - 42 %} - {% set axis = 'Y' %} - {% set positive = 1 %} - G0 A90 C-5 F3600 - {% elif point=='CX1' %} - {% set target_x = wcs_probe_2[0] + 80 %} - {% set target_y = wcs_probe_2[1] - 3 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z - 55 %} - {% set axis = 'X' %} - G0 A90 - {% elif point=='CX2' %} - {% set target_x = wcs_probe_2[0] - 80 %} - {% set target_y = wcs_probe_2[1] - 3 %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z - 55 %} - {% set axis = 'X' %} - {% set positive = 1 %} - G0 A90 - {% elif point=='CX1_1' %} - {% set target_x = wcs_probe_2[0] + 20 %} - {% set target_y = wcs_probe_2[1] %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z - 5 %} - {% set axis = 'X' %} - G0 A90 C60 - {% elif point=='CX2_2' %} - {% set target_x = wcs_probe_2[0] - 20 %} - {% set target_y = wcs_probe_2[1] %} - {% set target_z = printer['gcode_macro PROBE_TEMPLATE_POINT'].wcs2_probe_z - 5 %} - {% set axis = 'X' %} - {% set positive = 1 %} - G0 A90 C60 - {% endif %} - {% if target_y|float > (max_y - 4.3) %} - {% set target_y = max_y - 4.3 %} - {% endif %} - G0 X{target_x} Y{target_y} F3600 - G0 Z{target_z} F3600 - PROBE AXIS={axis} POSITIVE_DIR={positive} - G0 X{target_x} Y{target_y} F3600 - G0 Z{wcs_probe_2[2] + 30} F3600 - G0 A0 C0 F3600 - -[gcode_macro PROBE_TOOL_POINT] -Description: This macro does movement and measurement relative to the tool. -gcode: - {% set point = params.POINT %} - {% set wcs = params.WCS|int %} - {% set positiv_dir = 0 %} - {% set offsets = printer.probe.offsets %} - {% set wcs_offsets = printer.gcode_move.wcs_offsets[wcs] %} - {% set x = wcs_offsets[0] - offsets[0] %} - {% set y = wcs_offsets[1] - offsets[1] %} - {% set z = wcs_offsets[2] + offsets[2] %} - {% set max_z = printer.toolhead.axis_maximum[2]|float %} - {% set radius = printer.auto_wcs.tooling_radius|float %} - {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].tool_length|float %} - {% set a = '0' if wcs == 1 else '90' %} - {% set c = 0 %} - {% set checking = 'true' %} - {% set msg = '206: Error when moving and measuring relative to the tool' %} - {% if point == 'X_1_0' %} - {% set x = x - (radius + 10) %} - {% set z = z - 5 %} - {% set axis_name = 'X' %} - {% set positiv_dir = 1 %} - {% elif point == 'X_1_1' %} - {% set axis_name = 'X' %} - {% set x = x + 10 + radius %} - {% set z = z - 5 %} - {% elif point == 'Y_1_0' %} - {% set axis_name = 'Y' %} - {% set positiv_dir = 1 %} - {% set y = y - (radius + 10) %} - {% set z = z - 5 %} - {% set checking = 'true' if radius < 10.0 else 'false' %} - {% set msg = '205: Error, radius by tool not enough, more 10 mm.' %} - {% elif point == 'Y_1_1' %} - {% set axis_name = 'Y' %} - {% set z = z - 5 %} - {% set y = y + (radius + 10) %} - {% if y > printer.toolhead.axis_maximum[1]|float %} - {% set y = printer.toolhead.axis_maximum[1]|float - 1 %} - {% endif %} - {% set checking = 'true' if radius < 10.0 else 'false' %} - {% set msg = '205: Error, radius by tool not enough, more 10 mm.' %} - {% elif point == 'Y_1' %} - ; move for get advance radius - {% set axis_name = 'Y' %} - {% set positiv_dir = 1 %} - {% set y = y - 60 %} - {% set z = z - 5 %} - {% elif point == 'Z_1' %} - {% set axis_name = 'Z' %} - {% set z = max_z / 2.0 %} - {% set a = 0 %} - G28 A - {% elif point == 'X_2_0' %} - {% set axis_name = 'X' %} - {% set positiv_dir = 1 %} - {% set x = x - 15 %} - {% set y = y + 1 %} - {% set z = z + (radius - 5) %} - {% set checking = 'true' if tool_length > 35.0 else 'false' %} - {% set msg = '208: Error, tool length not enough, less 35 mm.' %} - {% elif point == 'X_2_1' %} - {% set axis_name = 'X' %} - {% set x = x + 15 %} - {% set y = y + 1 %} - {% set z = z + (radius - 5) %} - {% set checking = 'true' if tool_length > 35.0 else 'false' %} - {% set msg = '208: Error, tool length not enough, less 35 mm.' %} - {% elif point == 'X_2_2' %} - {% set axis_name = 'X' %} - {% set positiv_dir = 1 %} - {% set x = x - 15 %} - {% set y = y + 16 %} - {% set z = z + (radius - 5) %} - {% set checking = 'true' if tool_length > 50.0 else 'false' %} - {% set msg = '207: Error, tool length lees 50 mm.' %} - {% elif point == 'X_2_3' %} - {% set axis_name = 'X' %} - {% set x = x + 15 %} - {% set y = y + 16 %} - {% set z = z + (radius - 5) %} - {% set checking = 'true' if tool_length > 50.0 else 'false' %} - {% set msg = '207: Error, tool length lees 50 mm.' %} - {% elif point == 'X_2_4' %} - {% set axis_name = 'X' %} - {% set positiv_dir = 1 %} - {% set x = x - 15 %} - {% set y = y + 1 %} - {% set z = z + (radius - 5) %} - {% set c = 60 %} - {% set checking = 'true' if tool_length > 35.0 else 'false' %} - {% set msg = '208: Error, tool length not enough, less 35 mm.' %} - {% elif point == 'X_2_5' %} - {% set axis_name = 'X' %} - {% set positiv_dir = 1 %} - {% set x = x - 15 %} - {% set y = y + 16 %} - {% set z = z + (radius - 5) %} - {% set c = 60 %} - {% set checking = 'true' if tool_length > 50.0 else 'false' %} - {% set msg = '207: Error, tool length lees 50 mm.' %} - {% elif point == 'Y_2' %} - {% set axis_name = 'Y' %} - {% set positiv_dir = 1 %} - {% set y = y - 20 %} - {% set z = z + (radius - 4) %} - {% set checking = 'true' if tool_length > 35.0 else 'false' %} - {% set msg = '208: Error, tool length not enough, less 35 mm.' %} - {% elif point == 'Z_2_0' %} - {% set axis_name = 'Z' %} - {% set y = y + 1 %} - {% set z = z + (radius + 10) %} - {% set checking = 'true' if tool_length > 35.0 else 'false' %} - {% set msg = '208: Error, tool length not enough, less 35 mm.' %} - {% elif point == 'Z_2_1' %} - {% set axis_name = 'Z' %} - {% set y = y + 25 %} - {% set z = z + (radius + 10) %} - {% set checking = 'true' if tool_length > 35.0 else 'false' %} - {% set msg = '208: Error, tool length not enough, less 35 mm.' %} - {% elif point == 'Z_2_2' %} - {% set axis_name = 'Z' %} - {% set y = y + 1 %} - {% set z = z + (radius + 10) %} - {% set c = 60 %} - {% set checking = 'true' if tool_length > 35.0 else 'false' %} - {% set msg = '208: Error, tool length not enough, less 35 mm.' %} - {% elif point == 'Z_2_3' %} - {% set axis_name = 'Z' %} - {% set y = y + 25 %} - {% set z = z + (radius + 10) %} - {% set c = 60 %} - {% set checking = 'true' if tool_length > 35.0 else 'false' %} - {% set msg = '208: Error, tool length not enough, less 35 mm.' %} - {% endif %} - {% if checking == 'true' %} - G0 A{a} C{c} F3600 - G0 X{x} Y{y} F3600 - G0 Z{z} F3600 - PROBE AXIS={axis_name} POSITIVE_DIR={positiv_dir} - G0 X{x} Y{y} F3600 - G0 Z{z + radius + 10} F3600 - {% else %} - {action_raise_error(msg)} - {% endif %} - -[gcode_macro SETTINGS_APPLY_SKEW] -description: This macro save user settings for apply skew compensation. -variable_apply_skew: 0 -gcode: - {% set apply_skew = params.APPLY|default(0)|int %} - {% if apply_skew != printer["gcode_macro SETTINGS_APPLY_SKEW"].apply_skew|int %} - SET_GCODE_VARIABLE MACRO=SETTINGS_APPLY_SKEW VARIABLE=apply_skew VALUE={apply_skew} - {action_respond_info("Set apply_skew=%s." % apply_skew)} - SAVE_VARIABLE VARIABLE=apply_skew VALUE={apply_skew} - {% endif %} - -[gcode_macro SETTINGS_MEASURE_SKEW] -description: This macro save user settings for measuring skew compensation. -variable_measure_skew: 0 -gcode: - {% set measure_skew = params.MEASURE|default(0)|int %} - {% if measure_skew != printer["gcode_macro SETTINGS_MEASURE_SKEW"].measure_skew|int %} - SET_GCODE_VARIABLE MACRO=SETTINGS_MEASURE_SKEW VARIABLE=measure_skew VALUE={measure_skew} - {action_respond_info("Set measure_skew=%s." % measure_skew)} - SAVE_VARIABLE VARIABLE=measure_skew VALUE={measure_skew} - {% endif %} diff --git a/stereotech_config/750/probe_v3.cfg b/stereotech_config/750/probe_v3.cfg deleted file mode 100644 index c696888761c5..000000000000 --- a/stereotech_config/750/probe_v3.cfg +++ /dev/null @@ -1,131 +0,0 @@ -[gcode_macro CHECK_SENSOR_VERSION_AND_START_AUTOCALIBRATE] -description: macro to continue automatic calibration depending on the version of the sensor -gcode: - AUTO_WCS_OFFSET_NEW_SERNSOR - -[gcode_macro AUTO_WCS_OFFSET_NEW_SERNSOR] -description: macro do move for measuring and calculated WCS. Sensor DAC_v_1 -gcode: - {% if printer["gcode_button five_axis_module"].state == "PRESSED" %} - {% set probe_sensor_version = 1 %} - ADJUST_TEMPLATE_HEIGHT WCS=1 - ADJUST_TEMPLATE_HEIGHT WCS=2 - ; aligning template, axis C - PROBE_TEMPLATE_POINT POINT=AY - SET_C_ALIGN_POINT POINT=0 - PROBE_TEMPLATE_POINT POINT=BY - SET_C_ALIGN_POINT POINT=1 - CALC_C_AXIS_ALIGN - ; main moves for get and set the wcs coordinates - ; get wcs3_z - PROBE_TEMPLATE_POINT POINT=O_1 - SET_AUTO_WCS_POINT POINT=0 - ; get wcs3_y - PROBE_TEMPLATE_POINT POINT=AY2_2 - SET_AUTO_WCS_POINT POINT=7 - PROBE_TEMPLATE_POINT POINT=AY1_2 - SET_AUTO_WCS_POINT POINT=1 - # get wcs_3_x - PROBE_TEMPLATE_POINT POINT=AX3 - SET_AUTO_WCS_POINT POINT=2 - PROBE_TEMPLATE_POINT POINT=BX3 - SET_AUTO_WCS_POINT POINT=3 - # get wcs4_z - PROBE_TEMPLATE_POINT POINT=DZ_2 - SET_AUTO_WCS_POINT POINT=4 - # get wcs4_y - PROBE_TEMPLATE_POINT POINT=DY_1 - SET_AUTO_WCS_POINT POINT=5 - PROBE_TEMPLATE_POINT POINT=EY_1 - SET_AUTO_WCS_POINT POINT=6 - # get wcs4_x - PROBE_TEMPLATE_POINT POINT=CX1_1 - SET_AUTO_WCS_POINT POINT=8 - PROBE_TEMPLATE_POINT POINT=CX2_2 - SET_AUTO_WCS_POINT POINT=9 - ; calculating start wcs coordinates - {% set template_thickness = printer.save_variables.variables.template_thickness|default(10.0)|float %} - {% set auto_wcs_adj = printer.save_variables.variables.auto_wcs_adj|default(0.25)|float %} - CALC_WCS_PARAMS THICKNESS={ template_thickness } ADJUSTMENT={ auto_wcs_adj } SENSOR_VERSION={probe_sensor_version} - ; aligning template, axis C - PROBE_TEMPLATE_POINT POINT=AY - SET_C_ALIGN_POINT POINT=0 - PROBE_TEMPLATE_POINT POINT=BY - SET_C_ALIGN_POINT POINT=1 - CALC_C_AXIS_ALIGN - ; move for get and set probe_offset - MOVE_TO_AUTO_WCS - {% endif %} - -[gcode_macro AUTO_BASEMENT_WCS] -description: macro do main moves for get wcs for SPIRAL and FULL modes. -gcode: - {% set wcs = params.WCS|default(0)|int %} - {% if wcs == 0 %} - MOVE_AUTOCALIBRATE_FULL_V_2 - {% else %} - ; meachuring for mode the SPIRAL - MOVE_AUTOCALIBRATE_SPIRAL_V_2 - {% endif %} - -[gcode_macro ADJUST_BASEMENT_WCS] -gcode: - {% set wcs = params.WCS|default(0)|int %} - {% set point = printer.probe.last_result %} - {% set offsets = printer.probe.offsets %} - {% set wcs_0 = printer.gcode_move.wcs_offsets[3] %} - {% set x = point[0] + offsets[0] - printer.gcode_move.homing_origin.x %} - {% set y = point[1] + offsets[1] - printer.gcode_move.homing_origin.y %} - {% set z = point[2] - offsets[2] - printer.gcode_move.homing_origin.z %} - {% set wcs_1 = printer.gcode_move.wcs_offsets[4] %} - {% set old_z = wcs_0[2] %} - {% set old_y = wcs_1[1] %} - {% set probe_backlash_y = printer.auto_wcs.probe_backlash_y|default(0.0)|float %} - {% set tool_length = printer['gcode_macro GET_TOOL_LENGTH'].tool_length|float %} - {% set radius = printer.auto_wcs.tooling_radius %} - {% set auto_wcs_adj = printer.save_variables.variables["auto_wcs_adj"]|default(0.0)|float %} - {% if wcs == 0 %} - ; Mode SPIRAL-FULL - ; apply measuring for the set wcs_2_z radius. - {% if tool_length > 35.0 %} - ; FOR DEBUG - {action_respond_info('\n-----------calculate wcs_2_z: probe_offset=%s; point_z=%s; radius=%s; auto_wcs_adj=%s; wcs_2_z=%s;\n' % (offsets[2], point[2], radius, auto_wcs_adj, (z - radius + auto_wcs_adj)))} - G10 L2 P3 Z{z - radius + auto_wcs_adj} - {% else %} - {action_raise_error('204: Error, tool length not enough for calculate wcs_2_y')} - {% endif %} - {% elif wcs == 1 %} - ; Mode SPIRAL - {% if radius < 5.0 and tool_length > 35.0 %} - G10 L2 P3 Z{z - radius} - {% else %} - ; apply measuring for the set wcs_2_y and wcs_1_z(raw). - G10 L2 P3 Y{y} - G10 L2 P2 Z{old_z - (y - old_y)} - {% endif %} - {% elif wcs == 2 %} - ; set wcs_1_z and wcs_2_y(raw). - ; FOR DEBUG - {action_respond_info('\n-----------calculate wcs_1_z: probe_offset=%s; point_z=%s; auto_wcs_adj=%s; wcs_1_z=%s;\n' % (offsets[2], point[2], auto_wcs_adj, (z + auto_wcs_adj)))} - G10 L2 P2 Z{z + auto_wcs_adj } - G10 L2 P3 Y{old_y - (z - old_z)} - {% elif wcs == 3 %} - ; apply measuring for the set wcs_2_y - G10 L2 P3 Y{y + probe_backlash_y} - {% elif wcs == 4 %} - {% set x = printer.auto_wcs.wcs[0][0]|float %} - ; set wcs_1_x - G10 L2 P2 X{x} - {% elif wcs == 5 %} - {% set y = printer.auto_wcs.wcs[0][1]|float %} - ; set wcs_1_y - G10 L2 P2 Y{y} - {% elif wcs == 6 %} - {% set x = printer.auto_wcs.wcs[1][0]|float %} - ; set the wcs_2_x - G10 L2 P3 X{x} - {% elif wcs == 7 %} - ; apply measuring for the set wcs_2_y and wcs_1_z(raw). - G10 L2 P3 Y{y} - G10 L2 P2 Z{old_z - (y - old_y)} - {% endif %} From 2bb8f17ce352cd0116679b86802d2d29c9a3b9ef Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Thu, 8 Feb 2024 06:48:29 +0000 Subject: [PATCH 7/8] STEAPP-904: Added to the manager adjust_basement_auto in spiral mode the movement of the toolhead in 35mm from the collet --- stereotech_config/calibrate/probe_5d_tool.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/stereotech_config/calibrate/probe_5d_tool.cfg b/stereotech_config/calibrate/probe_5d_tool.cfg index 8a9743398208..1d907e428e49 100644 --- a/stereotech_config/calibrate/probe_5d_tool.cfg +++ b/stereotech_config/calibrate/probe_5d_tool.cfg @@ -178,6 +178,7 @@ gcode: {% set y = wcs_offsets[1] - offsets[1] %} {% set z = wcs_offsets[2] + offsets[2] %} {% set a = '0' if wcs == 0 else '90' %} + {% set y = y if wcs == 0 else (y - 35) %} G28 A G0 A{a} F3600 G0 Z{max_z / 2} F3600 From 8215781b1f005d70fc0b3993c46d493f1a0dc841 Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Mon, 12 Feb 2024 13:36:13 +0000 Subject: [PATCH 8/8] =?UTF-8?q?STEAPP-733:=20Added=20recursive=20offset=20?= =?UTF-8?q?measurement=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