From 3ae841288c83ee981ff34faec338e8d6056cd8e2 Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Mon, 5 Feb 2024 14:04:38 +0000 Subject: [PATCH 1/7] STEAPP743: Added recursive offset measurement for the A-axis --- klippy/extras/a_axis_offset.py | 70 +++++++++++-------- stereotech_config/750/calibrate/probe_v3.cfg | 4 +- stereotech_config/calibrate/probe_5d.cfg | 16 +++++ .../calibrate/probe_5d_template.cfg | 15 +--- stereotech_config/calibrate/probe_5d_tool.cfg | 18 ----- stereotech_config/calibrate/probe_v2.cfg | 4 +- 6 files changed, 63 insertions(+), 64 deletions(-) diff --git a/klippy/extras/a_axis_offset.py b/klippy/extras/a_axis_offset.py index 50c0acd36ab3..0ad3bf62aa82 100644 --- a/klippy/extras/a_axis_offset.py +++ b/klippy/extras/a_axis_offset.py @@ -1,6 +1,8 @@ # Helper script to automate a axis offset calculation import math +import logging + RAD_TO_DEG = 57.295779513 @@ -10,15 +12,18 @@ 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.calc_offset = 0. + 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.], [0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0.] ] - self.gcode.register_command('CALC_A_AXIS_OFFSET', - self.cmd_CALC_A_AXIS_OFFSET, - desc=self.cmd_CALC_A_AXIS_OFFSET_help) + self.gcode.register_command( + 'ALIGN_A_AXIS', self.cmd_ALIGN_A_AXIS, + desc=self.cmd_ALIGN_A_AXIS_help) self.gcode.register_command( 'SAVE_A_AXIS_POINT', self.cmd_SAVE_A_AXIS_POINT, desc=self.cmd_SAVE_A_AXIS_POINT_help) @@ -41,37 +46,46 @@ def cmd_SAVE_A_AXIS_POINT(self, gcmd): self.point_coords[point_idx][axis] = coord def _calc_a_axis_offset(self, point_0, point_1): - offset = RAD_TO_DEG * math.asin((point_1[2] - point_0[2]) / math.hypot( - point_1[1] - point_0[1], point_1[2] - point_0[2])) + """ + . b + . . + . . + a . . . . c + """ + bc = point_1[2] - point_0[2] + ac = point_1[1] - point_0[1] + ab = math.hypot(ac, bc) + asin_a = math.asin(bc / ab) + offset = RAD_TO_DEG * asin_a + logging.info("calculate offset A=%f." % offset) return offset - cmd_CALC_A_AXIS_OFFSET_help = "Calculate A axis offset" - def cmd_CALC_A_AXIS_OFFSET(self, gcmd): - offset = self._calc_a_axis_offset( - self.point_coords[0], self.point_coords[1]) + def _apply_offset_a(self): homing_origin_a = self.gcode_move.get_status()['homing_origin'].a - if homing_origin_a + offset > 0.0: - offset = 0.0 + if (homing_origin_a + self.calc_offset) > 0.0: + logging.warning("A-axis offset is positive") + self.calc_offset = 0.0 offset_gcmd = self.gcode.create_gcode_command( - 'SET_GCODE_OFFSET', 'SET_GCODE_OFFSET', {'A_ADJUST': offset}) + 'SET_GCODE_OFFSET', 'SET_GCODE_OFFSET', {'A_ADJUST': self.calc_offset}) self.gcode_move.cmd_SET_GCODE_OFFSET(offset_gcmd) - gcmd.respond_info("calculate offset for the axis A: %f." % offset) + logging.info("----------------apply offset for the axis A: %f." % self.calc_offset) + + cmd_ALIGN_A_AXIS_help = "Calculate A axis offset" + def cmd_ALIGN_A_AXIS(self, gcmd): + mode = gcmd.get('MODE') + for i in range(self.max_repeat_probe): + self.gcode.run_script_from_command("MOVE_ALIGN_A_AXIS MODE=%s" % mode) + self.calc_offset = self._calc_a_axis_offset(self.point_coords[0], self.point_coords[1]) + if (self.threshold_value * -1) <= self.calc_offset <= self.threshold_value: + break + else: + self._apply_offset_a() - # cmd_CALC_A_AXIS_OFFSET_TOOL_help = "Calculate A axis offset by tool" - # def cmd_CALC_A_AXIS_OFFSET_TOOL(self, gcmd): - # # get average value axis Z - # self.point_coords[0][2] = (self.point_coords[0][2] + self.point_coords[2][2]) / 2. - # self.point_coords[1][2] = (self.point_coords[1][2] + self.point_coords[3][2]) / 2. - # # calculate offset - # offset = self._calc_a_axis_offset( - # self.point_coords[0], self.point_coords[1]) - # homing_origin_a = self.gcode_move.get_status()['homing_origin'].a - # if homing_origin_a + offset > 0.0: - # offset = 0.0 - # offset_gcmd = self.gcode.create_gcode_command( - # 'SET_GCODE_OFFSET', 'SET_GCODE_OFFSET', {'A_ADJUST': offset}) - # self.gcode_move.cmd_SET_GCODE_OFFSET(offset_gcmd) - # gcmd.respond_info("calculate offset for the axis A: %f." % offset) + def get_status(self, eventtime=None): + return { + "point_coords": self.point_coords, + "calc_offset": self.calc_offset + } def load_config(config): diff --git a/stereotech_config/750/calibrate/probe_v3.cfg b/stereotech_config/750/calibrate/probe_v3.cfg index 79193c069e3a..bd2251afb930 100644 --- a/stereotech_config/750/calibrate/probe_v3.cfg +++ b/stereotech_config/750/calibrate/probe_v3.cfg @@ -56,7 +56,7 @@ gcode: ; set approximate radius, length and measuring the wcs_1_z CALC_TOOL_PARAMS LENGTH=1 APPROXIMATE_RADIUS=1 ; checking and apply offset for axis A - ALIGN_A_AXIS_TOOL + ALIGN_A_AXIS MODE=tool ; move for measuring the wcs_2_y PROBE_TOOL_POINT POINT=A_Y_A90 ADJUST_BASEMENT_WCS_V2 WCS=2 @@ -107,7 +107,7 @@ gcode: {% set tool_length = printer['gcode_macro CALC_TOOL_PARAMS'].length|float %} {% if radius < 5.0 and tool_length > 35.0 %} ; checking and apply offset for axis A - ALIGN_A_AXIS_TOOL + ALIGN_A_AXIS MODE=tool ; move for measuring the wcs_2_x PROBE_TOOL_POINT POINT=A_X_A90 SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=0 diff --git a/stereotech_config/calibrate/probe_5d.cfg b/stereotech_config/calibrate/probe_5d.cfg index 948363157f51..3ba6096d9e83 100644 --- a/stereotech_config/calibrate/probe_5d.cfg +++ b/stereotech_config/calibrate/probe_5d.cfg @@ -197,3 +197,19 @@ gcode: {% set wcs_4 = printer.gcode_move.wcs_offsets[4] %} G10 L2 P2 X{wcs_3[0]} Y{wcs_3[1]} Z{wcs_3[2]} G10 L2 P3 X{wcs_4[0]} Y{wcs_4[1]} Z{wcs_4[2]} + +[gcode_macro MOVE_ALIGN_A_AXIS] +description: movements to obtain the points necessary to calculate the offset of the A axis +gcode: + {% set mode = params.MODE %} + {% if mode == 'template' %} + PROBE_TEMPLATE_POINT POINT=A_Z + SET_POINT MACRO=SAVE_A_AXIS_POINT POINT=0 + PROBE_TEMPLATE_POINT POINT=B_Z + SET_POINT MACRO=SAVE_A_AXIS_POINT POINT=1 + {% elif mode == 'tool' %} + PROBE_TOOL_POINT POINT=B_Z_A90 + SET_POINT MACRO=SAVE_A_AXIS_POINT POINT=0 + PROBE_TOOL_POINT POINT=A_Z_A90 + SET_POINT MACRO=SAVE_A_AXIS_POINT POINT=1 + {% endif %} diff --git a/stereotech_config/calibrate/probe_5d_template.cfg b/stereotech_config/calibrate/probe_5d_template.cfg index ac4f80c5076a..938469c9ab2b 100644 --- a/stereotech_config/calibrate/probe_5d_template.cfg +++ b/stereotech_config/calibrate/probe_5d_template.cfg @@ -8,7 +8,7 @@ gcode: G0 C0 ADJUST_TEMPLATE_HEIGHT A=0 ALIGN_C_AXIS - ALIGN_A_AXIS + ALIGN_A_AXIS MODE=template ADJUST_TEMPLATE_HEIGHT A=0 ADJUST_TEMPLATE_HEIGHT A=90 AUTO_WCS @@ -44,19 +44,6 @@ gcode: CALC_C_AXIS_ALIGN {% endfor %} -[gcode_macro ALIGN_A_AXIS] -description: align template along horizontal plane -variable_repeat: 2 -gcode: - {% set repeat = printer["gcode_macro ALIGN_A_AXIS"].repeat %} - {% for idx in range(repeat) %} - PROBE_TEMPLATE_POINT POINT=A_Z - SET_POINT MACRO=SAVE_A_AXIS_POINT POINT=0 - PROBE_TEMPLATE_POINT POINT=B_Z - SET_POINT MACRO=SAVE_A_AXIS_POINT POINT=1 - CALC_A_AXIS_OFFSET - {% endfor %} - [gcode_macro MOVE_TO_AUTO_WCS] gcode: {% set set_xy = params.XY|default(0) %} diff --git a/stereotech_config/calibrate/probe_5d_tool.cfg b/stereotech_config/calibrate/probe_5d_tool.cfg index 8a9743398208..e1be8a96a7f3 100644 --- a/stereotech_config/calibrate/probe_5d_tool.cfg +++ b/stereotech_config/calibrate/probe_5d_tool.cfg @@ -69,24 +69,6 @@ gcode: G10 L2 P{wcs + 1} {axis_names[axis]}{value} {% endif %} -[gcode_macro ALIGN_A_AXIS_TOOL] -description: align template along horizontal plane -variable_repeat: 2 -gcode: - {% set repeat = printer["gcode_macro ALIGN_A_AXIS_TOOL"].repeat %} - {% for idx in range(repeat) %} - PROBE_TOOL_POINT POINT=B_Z_A90 - SET_POINT MACRO=SAVE_A_AXIS_POINT POINT=0 - PROBE_TOOL_POINT POINT=A_Z_A90 - SET_POINT MACRO=SAVE_A_AXIS_POINT POINT=1 - # PROBE_TOOL_POINT POINT=B_Z_A90_C60 - # SET_POINT MACRO=SAVE_A_AXIS_POINT POINT=2 - # PROBE_TOOL_POINT POINT=A_Z_A90_C60 - # SET_POINT MACRO=SAVE_A_AXIS_POINT POINT=3 - # CALC_A_AXIS_OFFSET_TOOL - CALC_A_AXIS_OFFSET - {% endfor %} - [gcode_macro CHECK_SKEW_TOOL] description: This macro calculates the x-axis skew between four points using the average. gcode: diff --git a/stereotech_config/calibrate/probe_v2.cfg b/stereotech_config/calibrate/probe_v2.cfg index 7ade33cc2363..6a9d5ba4fc25 100644 --- a/stereotech_config/calibrate/probe_v2.cfg +++ b/stereotech_config/calibrate/probe_v2.cfg @@ -49,7 +49,7 @@ gcode: ; set approximate radius, length and measuring the wcs_1_z CALC_TOOL_PARAMS LENGTH=1 APPROXIMATE_RADIUS=1 ; checking and apply offset for axis A - ALIGN_A_AXIS_TOOL + ALIGN_A_AXIS MODE=tool ; move for measuring the wcs_2_y PROBE_TOOL_POINT POINT=A_Y_A90 ADJUST_BASEMENT_WCS_V2 WCS=2 @@ -100,7 +100,7 @@ gcode: {% set tool_length = printer['gcode_macro CALC_TOOL_PARAMS'].length|float %} {% if radius < 5.0 and tool_length > 35.0 %} ; checking and apply offset for axis A - ALIGN_A_AXIS_TOOL + ALIGN_A_AXIS MODE=tool ; move for measuring the wcs_2_x PROBE_TOOL_POINT POINT=A_X_A90 SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=0 From 8deb63dbcdf896003caf9e19ad0a3b6721e9fdff Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Mon, 5 Feb 2024 14:20:19 +0000 Subject: [PATCH 2/7] STEAPP743: Added recursive offset measurement for the A-axis --- klippy/extras/a_axis_offset.py | 8 +- stereotech_config/750/probe_main.cfg | 988 --------------------------- stereotech_config/750/probe_v3.cfg | 131 ---- test/klippy/five_axis.test | 2 +- 4 files changed, 2 insertions(+), 1127 deletions(-) delete mode 100644 stereotech_config/750/probe_main.cfg delete mode 100644 stereotech_config/750/probe_v3.cfg diff --git a/klippy/extras/a_axis_offset.py b/klippy/extras/a_axis_offset.py index 0ad3bf62aa82..e7b4e11f39f4 100644 --- a/klippy/extras/a_axis_offset.py +++ b/klippy/extras/a_axis_offset.py @@ -68,7 +68,7 @@ def _apply_offset_a(self): offset_gcmd = self.gcode.create_gcode_command( 'SET_GCODE_OFFSET', 'SET_GCODE_OFFSET', {'A_ADJUST': self.calc_offset}) self.gcode_move.cmd_SET_GCODE_OFFSET(offset_gcmd) - logging.info("----------------apply offset for the axis A: %f." % self.calc_offset) + logging.info("apply offset for the axis A: %f." % self.calc_offset) cmd_ALIGN_A_AXIS_help = "Calculate A axis offset" def cmd_ALIGN_A_AXIS(self, gcmd): @@ -81,12 +81,6 @@ def cmd_ALIGN_A_AXIS(self, gcmd): else: self._apply_offset_a() - def get_status(self, eventtime=None): - return { - "point_coords": self.point_coords, - "calc_offset": self.calc_offset - } - def load_config(config): return AAxisOffsetCalculation(config) 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 %} diff --git a/test/klippy/five_axis.test b/test/klippy/five_axis.test index 3e8a871e4a56..6b93bdd783ed 100644 --- a/test/klippy/five_axis.test +++ b/test/klippy/five_axis.test @@ -4,5 +4,5 @@ CONFIG five_axis.cfg G28 SAVE_A_AXIS_POINT POINT=0 COORDS=100.0,140.0,120.0 SAVE_A_AXIS_POINT POINT=1 COORDS=100.0,90.0,110.0 -CALC_A_AXIS_OFFSET +ALIGN_A_AXIS MODE=tool SAVE_CONFIG From c8a61703f5e909c85bcd7961ec3ac339b6fbaa41 Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Mon, 5 Feb 2024 14:28:21 +0000 Subject: [PATCH 3/7] STEAPP743: Added recursive offset measurement for the A-axis --- klippy/extras/a_axis_offset.py | 2 +- test/klippy/five_axis.cfg | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/klippy/extras/a_axis_offset.py b/klippy/extras/a_axis_offset.py index e7b4e11f39f4..aeadd469e3d0 100644 --- a/klippy/extras/a_axis_offset.py +++ b/klippy/extras/a_axis_offset.py @@ -57,7 +57,7 @@ def _calc_a_axis_offset(self, point_0, point_1): ab = math.hypot(ac, bc) asin_a = math.asin(bc / ab) offset = RAD_TO_DEG * asin_a - logging.info("calculate offset A=%f." % offset) + logging.info("calculate offset for the axis A: %f." % offset) return offset def _apply_offset_a(self): diff --git a/test/klippy/five_axis.cfg b/test/klippy/five_axis.cfg index 9ed4ab97b3a1..bd2ce9a78a77 100644 --- a/test/klippy/five_axis.cfg +++ b/test/klippy/five_axis.cfg @@ -111,11 +111,10 @@ resolution: 1.0 x: 0.0 y: 0.0 z: 0.0 -a: 0.0 c: 0.0 e: 0.0 -#[a_axis_offset] +[a_axis_offset] [wcs_1] x: 160.7 From bbd108bcc4efd66a56784969543b35b9222758a5 Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Tue, 6 Feb 2024 06:11:53 +0000 Subject: [PATCH 4/7] =?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 --- test/klippy/five_axis.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/test/klippy/five_axis.cfg b/test/klippy/five_axis.cfg index bd2ce9a78a77..148eddf01965 100644 --- a/test/klippy/five_axis.cfg +++ b/test/klippy/five_axis.cfg @@ -111,6 +111,7 @@ resolution: 1.0 x: 0.0 y: 0.0 z: 0.0 +a: 0.0 c: 0.0 e: 0.0 From 8c3470156c8e51415005ff7cad78cfdba39ba27f Mon Sep 17 00:00:00 2001 From: Sokolov Evgenii <81033310+SokolovJek@users.noreply.github.com> Date: Tue, 6 Feb 2024 09:23:23 +0300 Subject: [PATCH 5/7] STEAPP-734: Update five_axis.test for complite test --- test/klippy/five_axis.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/klippy/five_axis.test b/test/klippy/five_axis.test index 6b93bdd783ed..da0f9ffd6a11 100644 --- a/test/klippy/five_axis.test +++ b/test/klippy/five_axis.test @@ -5,4 +5,4 @@ G28 SAVE_A_AXIS_POINT POINT=0 COORDS=100.0,140.0,120.0 SAVE_A_AXIS_POINT POINT=1 COORDS=100.0,90.0,110.0 ALIGN_A_AXIS MODE=tool -SAVE_CONFIG +; SAVE_CONFIG From 07be96e5f64e2a6154a11195b6d444678b3e0db7 Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Tue, 6 Feb 2024 08:39:57 +0000 Subject: [PATCH 6/7] STEAPP-734: edited test --- test/klippy/five_axis.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/klippy/five_axis.test b/test/klippy/five_axis.test index da0f9ffd6a11..66aa88824b67 100644 --- a/test/klippy/five_axis.test +++ b/test/klippy/five_axis.test @@ -3,6 +3,6 @@ CONFIG five_axis.cfg G28 SAVE_A_AXIS_POINT POINT=0 COORDS=100.0,140.0,120.0 -SAVE_A_AXIS_POINT POINT=1 COORDS=100.0,90.0,110.0 +SAVE_A_AXIS_POINT POINT=1 COORDS=100.0,90.0,119.5 ALIGN_A_AXIS MODE=tool -; SAVE_CONFIG +SAVE_CONFIG From 0613ae4f3cd9ac252e2ecad5c299538a8a974abb Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Mon, 12 Feb 2024 13:16:38 +0000 Subject: [PATCH 7/7] STEAPP-734: Added recursive offset measurement for the A-axis --- klippy/extras/a_axis_offset.py | 11 ++++++++++- stereotech_config/calibrate/probe_5d.cfg | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/klippy/extras/a_axis_offset.py b/klippy/extras/a_axis_offset.py index aeadd469e3d0..7098691556cb 100644 --- a/klippy/extras/a_axis_offset.py +++ b/klippy/extras/a_axis_offset.py @@ -27,6 +27,9 @@ def __init__(self, config): self.gcode.register_command( 'SAVE_A_AXIS_POINT', self.cmd_SAVE_A_AXIS_POINT, desc=self.cmd_SAVE_A_AXIS_POINT_help) + self.gcode.register_command( + 'MOVE_ALIGN_A_AXIS', self.cmd_MOVE_ALIGN_A_AXIS, + desc=self.cmd_MOVE_ALIGN_A_AXIS_help) cmd_SAVE_A_AXIS_POINT_help = "Save point for A axis offset" def cmd_SAVE_A_AXIS_POINT(self, gcmd): @@ -76,11 +79,17 @@ def cmd_ALIGN_A_AXIS(self, gcmd): for i in range(self.max_repeat_probe): self.gcode.run_script_from_command("MOVE_ALIGN_A_AXIS MODE=%s" % mode) self.calc_offset = self._calc_a_axis_offset(self.point_coords[0], self.point_coords[1]) - if (self.threshold_value * -1) <= self.calc_offset <= self.threshold_value: + if abs(self.calc_offset) <= self.threshold_value: break else: self._apply_offset_a() + cmd_MOVE_ALIGN_A_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_A_AXIS(self, gcmd): + homing_origin_a = self.gcode_move.get_status()['homing_origin'].a + gcmd.respond_info("offset A-axis= %s" % homing_origin_a) + def load_config(config): return AAxisOffsetCalculation(config) diff --git a/stereotech_config/calibrate/probe_5d.cfg b/stereotech_config/calibrate/probe_5d.cfg index 3ba6096d9e83..14f368ade293 100644 --- a/stereotech_config/calibrate/probe_5d.cfg +++ b/stereotech_config/calibrate/probe_5d.cfg @@ -200,6 +200,7 @@ gcode: [gcode_macro MOVE_ALIGN_A_AXIS] description: movements to obtain the points necessary to calculate the offset of the A axis +rename_existing: MOVE_ALIGN_A_AXIS_OLD gcode: {% set mode = params.MODE %} {% if mode == 'template' %}