179 lines
6.7 KiB
INI
179 lines
6.7 KiB
INI
#####################################################################
|
|
# Bed Mesh Definition
|
|
#####################################################################
|
|
[bed_mesh]
|
|
speed: 100
|
|
horizontal_move_z: 20
|
|
mesh_min: 15,15
|
|
mesh_max: 105,105
|
|
algorithm: lagrange
|
|
## relative_reference_index should be the location where the
|
|
## For the center of the bed: [(7x7)-1] / 2 = position 24
|
|
probe_count: 3,3
|
|
relative_reference_index: 4
|
|
#fade_start: 1
|
|
#fade_end: 10
|
|
#fade_target: 0
|
|
move_check_distance: 3
|
|
split_delta_z: 0.0125
|
|
mesh_pps: 2,2
|
|
#bicubic_tension: 0.2
|
|
|
|
|
|
#####################################################################
|
|
# Macros
|
|
#####################################################################
|
|
[gcode_macro BED_MESH_CALIBRATE]
|
|
rename_existing: _BED_MESH_CALIBRATE
|
|
description: Perform Mesh Bed Leveling with klicky automount
|
|
variable_parameter_AREA_START : 0,0
|
|
variable_parameter_AREA_END : 0,0
|
|
; the clearance between print area and probe area
|
|
variable_mesh_area_offset : 5.0
|
|
; number of sample per probe point
|
|
variable_probe_samples : 2
|
|
; minimum probe count
|
|
variable_min_probe_count : 3
|
|
; scale up the probe count, should be 1.0 ~ < variable_max_probe_count/variable_min_probe_count
|
|
variable_probe_count_scale_factor : 1.0
|
|
gcode:
|
|
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
|
{% if V %}
|
|
{ action_respond_info("Bed Mesh Calibrate") }
|
|
{% endif %}
|
|
|
|
BED_MESH_CLEAR
|
|
SMARTHOME
|
|
|
|
_CheckProbe action=query
|
|
G90
|
|
Attach_Probe_Lock
|
|
|
|
SMARTQGL
|
|
{% if params.AREA_START and params.AREA_END %}
|
|
{% set bedMeshConfig = printer["configfile"].config["bed_mesh"] %}
|
|
{% set safe_min_x = bedMeshConfig.mesh_min.split(",")[0]|float %}
|
|
{% set safe_min_y = bedMeshConfig.mesh_min.split(",")[1]|float %}
|
|
{% set safe_max_x = bedMeshConfig.mesh_max.split(",")[0]|float %}
|
|
{% set safe_max_y = bedMeshConfig.mesh_max.split(",")[1]|float %}
|
|
|
|
{% set area_min_x = params.AREA_START.split(",")[0]|float %}
|
|
{% set area_min_y = params.AREA_START.split(",")[1]|float %}
|
|
{% set area_max_x = params.AREA_END.split(",")[0]|float %}
|
|
{% set area_max_y = params.AREA_END.split(",")[1]|float %}
|
|
|
|
{% if bedMeshConfig.probe_count.split(",")|length == 2 %}
|
|
{% set meshPointX = bedMeshConfig.probe_count.split(",")[0]|int %}
|
|
{% set meshPointY = bedMeshConfig.probe_count.split(",")[1]|int %}
|
|
{% else %}
|
|
{% set meshPointX = bedMeshConfig.probe_count.split(",")[0]|int %}
|
|
{% set meshPointY = bedMeshConfig.probe_count.split(",")[0]|int %}
|
|
{% endif %}
|
|
|
|
{% set meshMaxPointX = meshPointX %}
|
|
{% set meshMaxPointY = meshPointY %}
|
|
|
|
|
|
{% if (area_min_x < area_max_x) and (area_min_y < area_max_y) %}
|
|
{% if area_min_x - mesh_area_offset >= safe_min_x %}
|
|
{% set area_min_x = area_min_x - mesh_area_offset %}
|
|
{% else %}
|
|
{% set area_min_x = safe_min_x %}
|
|
{% endif %}
|
|
|
|
{% if area_min_y - mesh_area_offset >= safe_min_y %}
|
|
{% set area_min_y = area_min_y - mesh_area_offset %}
|
|
{% else %}
|
|
{% set area_min_y = safe_min_y %}
|
|
{% endif %}
|
|
|
|
{% if area_max_x + mesh_area_offset <= safe_max_x %}
|
|
{% set area_max_x = area_max_x + mesh_area_offset %}
|
|
{% else %}
|
|
{% set area_max_x = safe_max_x %}
|
|
{% endif %}
|
|
|
|
{% if area_max_y + mesh_area_offset <= safe_max_y %}
|
|
{% set area_max_y = area_max_y + mesh_area_offset %}
|
|
{% else %}
|
|
{% set area_max_y = safe_max_y %}
|
|
{% endif %}
|
|
|
|
{% set meshPointX = (meshPointX * (area_max_x - area_min_x) / (safe_max_x - safe_min_x) * probe_count_scale_factor)|round(0)|int %}
|
|
{% if meshPointX < min_probe_count %}
|
|
{% set meshPointX = min_probe_count %}
|
|
{% endif %}
|
|
{% if meshPointX > meshMaxPointX %}
|
|
{% set meshPointX = meshMaxPointX %}
|
|
{% endif %}
|
|
|
|
{% set meshPointY = (meshPointY * (area_max_y -area_min_y ) / (safe_max_y - safe_min_y) * probe_count_scale_factor )|round(0)|int %}
|
|
{% if meshPointY < min_probe_count %}
|
|
{% set meshPointY = min_probe_count %}
|
|
{% endif %}
|
|
{% if meshPointY > meshMaxPointY %}
|
|
{% set meshPointY = meshMaxPointY %}
|
|
{% endif %}
|
|
|
|
_BED_MESH_CALIBRATE mesh_min={area_min_x},{area_min_y} mesh_max={area_max_x},{area_max_y} probe_count={meshPointX},{meshPointY} samples={probe_samples|int}
|
|
{% else %}
|
|
_BED_MESH_CALIBRATE
|
|
{% endif %}
|
|
{% else %}
|
|
_BED_MESH_CALIBRATE
|
|
{% endif %}
|
|
Dock_Probe_Unlock
|
|
|
|
|
|
## use MESH_STORE -> generate MESH and save immediately
|
|
## use MESH_STORE SAVE=false -> generate MESH and save it later
|
|
[gcode_macro MESH_STORE]
|
|
variable_save_at_end: 'false'
|
|
gcode:
|
|
# set default parameter value
|
|
{% set save = params.SAVE|default('true') %}
|
|
BED_MESH_CALIBRATE
|
|
BED_MESH_PROFILE SAVE=Voron-Bed_Temp-{printer.heater_bed.target|int}C
|
|
BED_MESH_PROFILE REMOVE=default
|
|
# Move to Middle
|
|
G90 ; set absolute
|
|
G0 Z7.5 F900 ; lift nozzle
|
|
G0 X175 Y175 Z30 F7200 ; move to middle
|
|
{% if save|lower == 'true' %}
|
|
_PRINT_AR T="MESH: Save Config!"
|
|
SAVE_CONFIG
|
|
{% else %}
|
|
_PRINT_AR T="MESH: Save Config after print done"
|
|
SET_GCODE_VARIABLE MACRO=MESH_STORE VARIABLE=save_at_end VALUE='"true"'
|
|
{% endif %}
|
|
|
|
## use MESH_LOAD -> load an existing MESH
|
|
## use MESH_LOAD AUTO=true -> load an existing MESH or generate a new one and prepare it to be saved after print end
|
|
[gcode_macro MESH_LOAD]
|
|
# set that to true to enable autogeneration of a missing mesh
|
|
gcode:
|
|
# set default parameter value
|
|
{% set auto = params.AUTO|default('false') %}
|
|
{% set bed_temp = printer.heater_bed.target|int %}
|
|
{% if printer.configfile.config["bed_mesh Voron-Bed_Temp-" + bed_temp|string + "C"] is defined %}
|
|
BED_MESH_CLEAR
|
|
BED_MESH_PROFILE LOAD=Voron-Bed_Temp-{printer.heater_bed.target|int}C
|
|
_PRINT_AR T="{"MESH: Voron-Bed_Temp-" + bed_temp|string + "C loaded"}"
|
|
{% else %}
|
|
{% if auto|lower == 'true' %}
|
|
_PRINT_AR T="{"MESH: Voron-Bed_Temp-" + bed_temp|string + "C needs to be generated"}"
|
|
MESH_STORE SAVE=false
|
|
{% else %}
|
|
_PRINT_AR T="{"MESH ERROR: Voron-Bed_Temp-" + bed_temp|string + "C not defined"}"
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
## add this to your PRINT_END to save a mesh if needed 10 seconds after print ended
|
|
## UPDATE_DELAYED_GCODE ID=_MESH_SAVE DURATION=10
|
|
[delayed_gcode _MESH_SAVE]
|
|
gcode:
|
|
{% if printer["gcode_macro MESH_STORE"].save_at_end == 'true' %}
|
|
_PRINT_AR T="MESH: Save Config!"
|
|
SAVE_CONFIG
|
|
{% endif %}
|