v2.4: update z_calibration

This commit is contained in:
Konstantin Koslowski 2021-10-28 12:18:14 +02:00
parent fce3702a8a
commit 37cc42b363
5 changed files with 128 additions and 119 deletions

View file

@ -1,48 +1,48 @@
#####################################################################
# Macros
#####################################################################
[gcode_macro PRINT_START]
gcode:
{% set bed_temp = params.BED_TEMP|default(100)|float %}
{% set extruder_temp = params.EXTRUDER_TEMP|default(220)|float %}
{% set z_adjust = params.Z_ADJUST|default(0.0)|float %}
{% set retract = 10 %}
BED_MESH_CLEAR ; clear mesh
_CG28 ; Home the printer
G90 ; Use absolute coordinates
PARKCENTER ; Move to center
M117 Heating..
_HEATER_ON
M106 S255 ; set print fan to full speed
M140 S{bed_temp} ; Start bed heating
M190 S{bed_temp} ; Wait for bed to reach temperature
M109 S{extruder_temp} ; Set and wait for nozzle to reach temperature
M107 ; turn print fan off
QUAD_GANTRY_LEVEL PARK=false
M109 S{extruder_temp} ; Set and wait for nozzle to reach temperature
clean_nozzle ; clean nozzle
CALIBRATE_Z
#BED_MESH_PROFILE LOAD=default ; load mesh if needed
# Adjust the G-Code Z offset with the Z_ADJUST parameter if needed
#SET_GCODE_OFFSET Z_ADJUST={z_adjust} MOVE=1
M117 Intro Line..
G90 ; Use absolute coordinates
G1 Y0 X130 Z5 F12000 ; Move the nozzle to the front and near the bed
G1 Z0.7 F300 ; Move the nozzle very close to the bed
G92 E0.0 ; set extruder position to 0
G1 E{retract} F3600 ; extrude retract
G92 E0.0 ; set extruder option to 0
G1 X180 E15.0 F500.0 ; intro line
G92 E0.0 ; set extruder Poisson to 0
G1 X174 F6000 ; move away from intro line
M117
[gcode_macro PARKCENTER]
gcode:
{% set Z = params.Z|default(30)|float %}
SAVE_GCODE_STATE NAME=PARKCENTER_state
_CG28 ; Home if not already homed
G90 ; absolute positioning
G0 X150 Y150 Z{Z} F12000 ; move to center
RESTORE_GCODE_STATE NAME=PARKCENTER_state
# #####################################################################
# # Macros
# #####################################################################
# [gcode_macro PRINT_START]
# gcode:
# {% set bed_temp = params.BED_TEMP|default(100)|float %}
# {% set extruder_temp = params.EXTRUDER_TEMP|default(220)|float %}
# {% set z_adjust = params.Z_ADJUST|default(0.0)|float %}
# {% set retract = 10 %}
# BED_MESH_CLEAR ; clear mesh
# _CG28 ; Home the printer
# G90 ; Use absolute coordinates
# PARKCENTER ; Move to center
# M117 Heating..
# _HEATER_ON
# M106 S255 ; set print fan to full speed
# M140 S{bed_temp} ; Start bed heating
# M190 S{bed_temp} ; Wait for bed to reach temperature
# M109 S{extruder_temp} ; Set and wait for nozzle to reach temperature
# M107 ; turn print fan off
# QUAD_GANTRY_LEVEL PARK=false
# M109 S{extruder_temp} ; Set and wait for nozzle to reach temperature
# clean_nozzle ; clean nozzle
# CALIBRATE_Z
# #BED_MESH_PROFILE LOAD=default ; load mesh if needed
# # Adjust the G-Code Z offset with the Z_ADJUST parameter if needed
# #SET_GCODE_OFFSET Z_ADJUST={z_adjust} MOVE=1
# M117 Intro Line..
# G90 ; Use absolute coordinates
# G1 Y0 X130 Z5 F12000 ; Move the nozzle to the front and near the bed
# G1 Z0.7 F300 ; Move the nozzle very close to the bed
# G92 E0.0 ; set extruder position to 0
# G1 E{retract} F3600 ; extrude retract
# G92 E0.0 ; set extruder option to 0
# G1 X180 E15.0 F500.0 ; intro line
# G92 E0.0 ; set extruder Poisson to 0
# G1 X174 F6000 ; move away from intro line
# M117
#
# [gcode_macro PARKCENTER]
# gcode:
# {% set Z = params.Z|default(30)|float %}
# SAVE_GCODE_STATE NAME=PARKCENTER_state
# _CG28 ; Home if not already homed
# G90 ; absolute positioning
# G0 X150 Y150 Z{Z} F12000 ; move to center
# RESTORE_GCODE_STATE NAME=PARKCENTER_state
#

View file

@ -1,37 +0,0 @@
#####################################################################
# User Variables
#####################################################################
[gcode_macro _USER_VARIABLE]
description: Helper: Contains User defined printer variables
##### Homing and general movement #####
variable_z_endstop_x: 208 ; z Endstop x position inside right profile
variable_z_endstop_y: 305 ; z Endstop y position
variable_z_hop: 10.0 ; z hop for moves e.g homing
variable_xy_home_current: 0.4 ; reduced homing current for x and y
variable_z_home_current: 0.3 ; reduced homing current for z
variable_home_accel: 1200 ; reduced ACCEL for homing
##### Mag Probe #####
variable_probe_dock_x: 148 ; x toolhead position before docking probe
variable_probe_dock_y: 285 ; y toolhead position before docking probe
variable_probe_dock_z: 10 ; z toolhead position before docking probe (only for bed dock)
variable_probe_undock_x: 200 ; x toolhead position after docking probe
variable_probe_undock_y: 305 ; y toolhead position after docking probe
variable_probe_undock_z: 10 ; z toolhead position after docking probe (only for bed dock)
variable_probe_z_min: 10 ; z minimum height to avoid crash
variable_probe_travel_speed: 200 ; dock moves travel speed
variable_probe_dock_speed: 100 ; dock speed for attach/dock
##### Respond defaults #####
variable_respond_set_current: 0 ; default of RESPOND if not set in the call
variable_respond_set_acc: 0 ; default of RESPOND if not set in the call
variable_respond_probe_action: 1 ; default of RESPOND if not set in the call
##### Park Position #####
variable_park_bed: [150,150,30] ; different park position
gcode:
#####################################################################
# Includes
#####################################################################
[include macros.cfg]
[include homing.cfg]
[include probing.cfg]
[include z_calibration.cfg]

View file

@ -1,127 +0,0 @@
#####################################################################
# Z Calibration
#####################################################################
[z_calibration]
# The X and Y coordinates (in mm) for clicking the nozzle on the
# Z endstop.
probe_nozzle_x: 208
probe_nozzle_y: 305
# The X and Y coordinates (in mm) for clicking the probe's switch
# on the Z endstop.
probe_switch_x: 201
probe_switch_y: 284
# The X and Y coordinates (in mm) for probing on the print surface
# (e.g. the center point) These coordinates will be adapted by the
# probe's X and Y offsets. The default is the relative_reference_index
# of the configured bed_mesh. It will raise an error if there is no
# probe_bed site and no bed_mesh with a relative_reference_index
# configured.
probe_bed_x: 150
probe_bed_y: 150
# The trigger point offset of the used mag-probe switch.
# This needs to be fined out manually. More on this later
# in this section..
switch_offset: 0.42
# The maximum allowed deviation of the calculated offset.
# If the offset exceeds this value, it will stop!
# The default is 1.0 mm.
max_deviation: 1.5
# The number of times to probe each point. The probed z-values
# will be averaged. The default is from the probe's configuration.
#samples: default from "probe:samples" section
# The maximum Z distance (in mm) that a sample may differ from other
# samples. The default is from the probe's configuration.
#samples_tolerance: default from "probe:samples_tolerance" section
# The number of times to retry if a sample is found that exceeds
# samples_tolerance. The default is from the probe's configuration.
#samples_tolerance_retries: default from "probe:samples_tolerance_retries" section
# The calculation method when sampling more than once - either
# "median" or "average". The default is from the probe's configuration.
#samples_result: default from "probe:samples_result" section
# The distance in mm to move up before moving to the next
# position. The default is two times the z_offset from the probe's
# configuration.
clearance: 7.5
#position_min: default from "stepper_z:position_min" section.
# The moving speed in X and Y. The default is 50 mm/s.
speed: 200
# Speed (in mm/s) of the Z axis when lifting the probe between
# samples and clearance moves. The default is from the probe's
# configuration.
#lift_speed: default from "probe:lift_speed" section
# The fast probing speed (in mm/s) used, when probing_first_fast
# is activated. The default is from the Z rail configuration.
#probing_speed: default from "stepper_z:homing_speed" section.
# The slower speed (in mm/s) for probing the recorded samples.
# The default is second_homing_speed of the Z rail configuration.
#probing_second_speed: default from "stepper_z:second_homing_speed" section.
# Distance to back off (in mm) before probing the next sample.
# The default is homing_retract_dist from the Z rail configuration.
#probing_retract_dist: default from "stepper_z:homing_retract_dist" section.
# If true, the first probing is done faster by the probing speed.
# This is to get faster down and the result is not recorded as a
# probing sample. The default is false.
probing_first_fast: true
# If true, the first probing is done faster by the probing speed.
# This is to get faster down and the result is not recorded as a
# probing sample. The default is false.
start_gcode: DETACH_PROBE
# A list of G-Code commands to execute prior to each calibration command.
# See docs/Command_Templates.md for G-Code format. This can be used to
# attach the probe.
before_switch_gcode: ATTACH_PROBE
# A list of G-Code commands to execute prior to each probing on the
# mag-probe. See docs/Command_Templates.md for G-Code format. This can be
# used to attach the probe after probing on the nozzle and before probing
# on the mag-probe.
end_gcode: DETACH_PROBE
# A list of G-Code commands to execute after each calibration command.
# See docs/Command_Templates.md for G-Code format. This can be used to
# detach the probe afterwards.
#####################################################################
## With these settings, the probe is attached after probing the nozzle
## and before probing the switch !!
#####################################################################
## Otherwise, starting with the probe attached would be like this:
start_gcode: ATTACH_PROBE
#before_switch_gcode: ATTACH_PROBE
end_gcode: DETACH_PROBE
#####################################################################
#####################################################################
# Macros
#####################################################################
###################################################################
# !!! Caution !!!
#
# This Macro is only needed if not using the start/end_gcode
# properties to attach/detach the probe
###################################################################
[gcode_macro CALIBRATE_Z]
description: Automatically calibrates the nozzles offset to the print surface and dock/undock MagProbe
rename_existing: CALIBRATE_Z_BASE
gcode:
##### get user defines #####
{% set z_hop = printer['gcode_macro _USER_VARIABLE'].probe_z_min|float %}
##### get toolhead parameters #####
{% set act_z = printer.gcode_move.gcode_position.z|float %}
#### end of definitions #####
## reduce current of motors
_SET_ACC VAL=HOME
_SET_CURRENT VAL=HOME
_CG28 RESET_SETTINGS=false
{% if act_z < z_hop %}
G90 ; absolute positioning
{action_respond_info("CALIBRATE_Z: High must be above %.2f" % z_hop)}
G1 Z{z_hop} F900 ; move head up
{% endif %}
#ATTACH_PROBE
CALIBRATE_Z_BASE
#DETACH_PROBE
{% if params.RESET_SETTINGS|default('true') == 'true' %}
## return to org current settings
_SET_CURRENT
_SET_ACC
{% endif %}