Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STEAPP-851: Made changes to the auto-calibration algorithm in the configuration of the 750th printer #231

Merged
merged 3 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions HTE750-0-0-23.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,22 @@ path: /home/ste/uploads
[include stereotech_config/750/module_3d_macros.cfg]
[include stereotech_config/750/module_5d.cfg]

[include stereotech_config/750/probe_main.cfg]
[include stereotech_config/750/probe_v3.cfg]
# sections probe
[include stereotech_config/750/calibrate/probe_750.cfg]
[include stereotech_config/750/calibrate/probe_v3.cfg]
[include stereotech_config/calibrate/probe_3d.cfg]
[include stereotech_config/calibrate/probe_5d.cfg]
[include stereotech_config/calibrate/probe_5d_tool.cfg]
[include stereotech_config/calibrate/probe_5d_template.cfg]

[include stereotech_config/750/print_macros.cfg]
[include stereotech_config/common/variables.cfg]
# [include stereotech_config/750/diagnostics.cfg]

[gcode_macro CONSTANTS]
description: Holds printer constants
variable_probe_a_horizontal: 301, 328, 57
# variable_probe_a_vertical: 301, 328, 107
variable_probe_a_vertical: 301, 328, 57
variable_probe_a_horizontal: 303, 329, 57
variable_probe_a_vertical: 303, 325, 55
variable_offsets_sensor: -60, -6, 29.0
variable_extruder_load_length: 210
variable_extruder1_load_length: 1650
Expand Down
93 changes: 93 additions & 0 deletions stereotech_config/750/calibrate/probe_750.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
[probe]
pin: !manta_mcu:probe_pin
samples: 4
samples_tolerance_retries: 1
samples_result: median
lift_speed: 10.0
x_offset: 0.0
y_offset: 0.0
z_offset: 0.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 AUTO_WCS]
gcode:
AUTO_WCS_OFFSET_V2

[gcode_macro AUTO_BASEMENT_WCS]
gcode:
AUTO_BASEMENT_WCS_V2 {rawparams}
MOVE_SERVICE_POSITION_HEAD PARKING=0

[gcode_macro ADJUST_BASEMENT_WCS]
gcode:
; pass
151 changes: 151 additions & 0 deletions stereotech_config/750/calibrate/probe_v3.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
[gcode_macro AUTO_WCS_OFFSET_V2]
description: macro do move for measuring and calculated WCS. Sensor DAC_v_2
gcode:
{% if printer["gcode_button five_axis_module"].state == "PRESSED" %}
; get wcs3_z
PROBE_TEMPLATE_POINT POINT=A_Z
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=0
; get wcs3_y
PROBE_TEMPLATE_POINT POINT=B_MY_A0_C30
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=7
PROBE_TEMPLATE_POINT POINT=B_Y_A0_C30
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=1
; get wcs3_x
PROBE_TEMPLATE_POINT POINT=C_X
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=2
PROBE_TEMPLATE_POINT POINT=D_MX
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=3
# get wcs4_z
PROBE_TEMPLATE_POINT POINT=A_Z_A90
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=4
# get wcs4_y
PROBE_TEMPLATE_POINT POINT=B_Y_A90_C60
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=5
PROBE_TEMPLATE_POINT POINT=B_MY_A90_C60
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=6
# get wcs4_x
PROBE_TEMPLATE_POINT POINT=B_MX_A90_C60
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=8
PROBE_TEMPLATE_POINT POINT=B_X_A90_C60
SET_POINT MACRO=SAVE_WCS_CALC_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.0)|float %}
CALC_WCS_PARAMS THICKNESS={ template_thickness } ADJUSTMENT={ auto_wcs_adj } SENSOR_VERSION=1
{% endif %}

[gcode_macro AUTO_BASEMENT_WCS_V2]
description: macro do main moves for get wcs for SPIRAL and FULL modes.
gcode:
RESET_WCS
SET_GCODE_VARIABLE MACRO=CALC_TOOL_PARAMS VARIABLE=length VALUE=999.0
SET_GCODE_VARIABLE MACRO=CALC_TOOL_PARAMS VARIABLE=radius VALUE=999.0
{% set wcs = params.WCS|default(0)|int %}
{% if wcs == 0 %}
MOVE_AUTOCALIBRATE_FULL_V2
{% else %}
MOVE_AUTOCALIBRATE_SPIRAL_V2
{% endif %}
SET_GCODE_VARIABLE MACRO=CALC_TOOL_PARAMS VARIABLE=length VALUE=999.0
SET_GCODE_VARIABLE MACRO=CALC_TOOL_PARAMS VARIABLE=radius VALUE=999.0

[gcode_macro MOVE_AUTOCALIBRATE_FULL_V2]
description: macro do move for measuring and calculated WCS for FULL-SPIRAL mode. Sensor DAC_v_2
gcode:
{% set max_z = printer.toolhead.axis_maximum[2]|float %}
; 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
; move for measuring the wcs_2_y
PROBE_TOOL_POINT POINT=A_Y_A90
ADJUST_BASEMENT_WCS_V2 WCS=2
; move for measuring the wcs_2_x
PROBE_TOOL_POINT POINT=A_X_A90
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=0
PROBE_TOOL_POINT POINT=A_MX_A90
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=1
CALC_WCS_TOOL WCS=2 AXIS=0 ADJUST=1
; set radius and measuring the wcs_2_z
CALC_TOOL_PARAMS APPROXIMATE_RADIUS=1 RADIUS=1
; move for measuring the wcs_1_x
PROBE_TOOL_POINT POINT=A_X
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=0
PROBE_TOOL_POINT POINT=A_MX
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=1
CALC_WCS_TOOL WCS=1 AXIS=0 ADJUST=1
; move for measuring the wcs_1_y
PROBE_TOOL_POINT POINT=A_Y
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=0
PROBE_TOOL_POINT POINT=A_MY
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=1
CALC_WCS_TOOL WCS=1 AXIS=1 ADJUST=1
; eccentricity correction
APPLY_ECCENTRICITY
; check skew axis X
CHECK_SKEW_TOOL

[gcode_macro MOVE_AUTOCALIBRATE_SPIRAL_V2]
description: macro do move for measuring and calculated WCS for SPIRAL mode. Sensor DAC_v_2
gcode:
{% set max_z = printer.toolhead.axis_maximum[2]|float %}
PROBE
G91
G1 Z25 F1500
G90
; set the wcs_1_z and wcs_2_y
ADJUST_BASEMENT_WCS_V2 WCS=1
; set approximate radius and length
CALC_TOOL_PARAMS LENGTH=1 APPROXIMATE_RADIUS=1 LEN_PROBE=0 APPROXIMATE_RADIUS_PROBE=0
; move to calculate wcs by tool
MOVE_MEASURING_SPIRAL

[gcode_macro MOVE_MEASURING_SPIRAL]
description: This macro do move and calculate wcs for SPIRAL mode.
gcode:
{% set radius = printer['gcode_macro CALC_TOOL_PARAMS'].radius|float %}
{% 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
; move for measuring the wcs_2_x
PROBE_TOOL_POINT POINT=A_X_A90
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=0
PROBE_TOOL_POINT POINT=A_MX_A90
SET_POINT MACRO=SAVE_WCS_CALC_POINT POINT=1
CALC_WCS_TOOL WCS=2 AXIS=0 ADJUST=1
; set precise radius and set the wcs_2_z
CALC_TOOL_PARAMS APPROXIMATE_RADIUS=1 RADIUS=1
; check skew axes
CHECK_SKEW_TOOL
{% 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 ADJUST_BASEMENT_WCS_V2]
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 CALC_TOOL_PARAMS'].length|float %}
{% set radius = printer['gcode_macro CALC_TOOL_PARAMS'].radius %}
{% set auto_wcs_adj = printer.save_variables.variables["auto_wcs_adj"]|default(0.0)|float %}
{% if wcs == 0 %}
G10 L2 P2 Z{z + auto_wcs_adj}
G10 L2 P3 Y{old_y - (z - old_z)}
{% elif wcs == 1 %}
G10 L2 P3 Y{y}
G10 L2 P2 Z{old_z - (y - old_y)}
{% elif wcs == 2 %}
G10 L2 P3 Y{y + probe_backlash_y}
{% elif wcs == 3 %}
G10 L2 P3 Z{z - radius + auto_wcs_adj}
{% endif %}
2 changes: 1 addition & 1 deletion stereotech_config/750/homing_override.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[homing_override]
rotate_a: true
rotate_a: false
axes:
gcode:
G28 Z
Expand Down
29 changes: 11 additions & 18 deletions stereotech_config/HTE750-0-0-23.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,37 +29,30 @@ path: /home/ste/uploads
[include config/common/extruder_macros.cfg]
[include config/common/filament_control.cfg]
[include config/common/filament_control_second.cfg]

# sections probe
# [include config/calibrate/probe_5-8-23.cfg]
# [include config/calibrate/probe_3d.cfg]
# [include config/calibrate/probe_5d.cfg]
# [include config/calibrate/probe_5d_tool.cfg]
# [include config/calibrate/probe_5d_template.cfg]
# [include config/calibrate/probe_v2.cfg]
# # sections new probe need adapted its
[include config/750/probe_main.cfg]
[include config/750/probe_v3.cfg]

# [include config/750/nozzle_offset.cfg]
[include config/common/extruder_macros.cfg]
# [include config/750/power_control.cfg]

[include config/750/module_3d.cfg]
[include config/750/module_3d_macros.cfg]
[include config/750/module_5d.cfg]

# sections probe
[include config/750/calibrate/probe_750.cfg]
[include config/750/calibrate/probe_v3.cfg]
[include config/calibrate/probe_3d.cfg]
[include config/calibrate/probe_5d.cfg]
[include config/calibrate/probe_5d_tool.cfg]
[include config/calibrate/probe_5d_template.cfg]

[include config/750/print_macros.cfg]
[include config/common/variables.cfg]
# [include config/750/diagnostics.cfg]

[gcode_macro CONSTANTS]
description: Holds printer constants
variable_probe_a_horizontal: 301, 328, 57
# variable_probe_a_vertical: 301, 328, 107
variable_probe_a_vertical: 301, 328, 57
variable_probe_a_horizontal: 303, 329, 57
variable_probe_a_vertical: 303, 325, 55
variable_offsets_sensor: -60, -6, 29.0
variable_extruder_load_length: 210
variable_extruder_load_length: 210
variable_extruder1_load_length: 1650
# variable_path_to_model_nozzle_offset: '/home/ste/klipper/config/common/model_hybrid_nozzle_offset.gcode'
gcode:
8 changes: 6 additions & 2 deletions stereotech_config/calibrate/probe_3d.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
description: 3D module calibration
gcode:
{% if printer["gcode_button five_axis_module"].state == "RELEASED" %}
G0 X197 Y195 F6000
{% 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
Expand All @@ -12,7 +16,7 @@ gcode:
G91
G0 Z30 F3600
G90
G0 X150 Y50 F3600
G0 X{center_probe_x + offsets[0]} Y50 F3600
{% endif %}

[gcode_macro MODULE_THREE_D_MESH_CALIBRATE]
Expand Down
5 changes: 4 additions & 1 deletion stereotech_config/calibrate/probe_5d.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ gcode:
{% set safe_distance_z = (probe_a_vertical[2] + 70 + offsets[2]) if a_deg == 'A90' else (probe_a_horizontal[2] + 20 + offsets[2]) %}
{% set axis = ax[-1] %}
{% set positive = 0 if (ax[0] == 'M' or ax[0] == 'Z') else 1 %}
{% if p == 'A' %}

{% if p == 'A' and target_a == 0.0 %}
{% set target_y = target_y - 4 %}
{% elif p == 'B' %}
{% if target_a == 0.0 and target_c == 0.0 %}
Expand All @@ -53,11 +54,13 @@ gcode:
{% set target_x = target_x + 50 %}
{% set target_y = target_y - 4 %}
{% endif %}

{% if ax != 'Z' %}
{% set target_z = target_z - 6 %}
{% else %}
{% set target_z = target_z + 20 %}
{% endif %}

{% if ax == 'X' %}
{% set target_x = target_x - 20 %}
{% set axis = 'X' %}
Expand Down
Loading
Loading