Klicky macros move to the main repository (#546)
* Updated macro for safer Z on Trident and Updated macro for safer Z on Trident and improved Z hop configuration * linked macros to main repository
This commit is contained in:
parent
bef3704f79
commit
d75de68ced
|
|
@ -1,7 +1 @@
|
|||
Voron V2.4/VT:
|
||||
If using the probe instead of a physical Z endstop please remember to comment out the homing override from your printer.cfg and use the klicky-probe.cfg one.
|
||||
|
||||
Voron V1.8:
|
||||
Due to the fact that the probe may hit the bed on the v1.8 when going to the physical Z endstop, please use the homing override included in klicky-probe.cfg instead of the one that you currently have in your printer.cfg .
|
||||
|
||||
You may have a faster PRINT_START if you use Attach_Probe_Lock at the beginning and Dock_Probe_Unlock at the end.
|
||||
Please download the Klipper macros form the main [Klicky repository](https://github.com/jlas1/Klicky-Probe).
|
||||
|
|
|
|||
|
|
@ -1,773 +0,0 @@
|
|||
# This macro was provided by discord user Garrettwp to whom i give my thanks for sharing it with me.
|
||||
# I have tweaked it a lot.
|
||||
#
|
||||
# this macro is based on the great Annex magprobe dockable probe macros "#Originally developed by Mental, modified for better use on K-series printers by RyanG and Trails"
|
||||
# that macro can be found here https://github.com/Annex-Engineering/Annex-Engineering_Other_Printer_Mods/blob/master/All_Printers/Microswitch_Probe/Klipper_Macros/dockable_probe_macros.cfg
|
||||
#
|
||||
# by standing on the shoulders of giants, lets see if we can see further
|
||||
|
||||
[gcode_macro _User_Variables]
|
||||
variable_verbose: True # Enable verbose output
|
||||
variable_travel_speed: 200 # how fast all other travel moves will be performed when running these macros
|
||||
variable_dock_speed: 50 # how fast should the toolhead move when docking the probe for the final movement
|
||||
variable_release_speed: 75 # how fast should the toolhead move to release the hold of the magnets after docking
|
||||
variable_z_drop_speed: 20 # how fast the z will lower when moving to the z location to clear the probe
|
||||
variable_home_z_height: 10 # Z when homing
|
||||
|
||||
#bed type
|
||||
variable_gravity: 'bed' # What goes down with gravity, bed or gantry?
|
||||
variable_max_bed_y: 250 # maximum Bed size avoids doing a probe_accuracy outside the bed
|
||||
|
||||
# if a separate Z endstop switch is in
|
||||
# use, specify the coordinates of the switch here (Voron).
|
||||
# Set to 0 to have the probe move to center of bed
|
||||
variable_z_endstop_x: 1000
|
||||
variable_z_endstop_y: 1000
|
||||
|
||||
#dock location
|
||||
variable_docklocation_x: 1000 # X Dock position
|
||||
variable_docklocation_y: 1000 # Y Dock position
|
||||
variable_docklocation_z: -128 # Z dock position (-128 for a gantry mount)
|
||||
variable_dockarmslenght: 30 # Dock arms lenght, toolhead movement necessary to clear the dock arms
|
||||
|
||||
#Umbilical to help untangle the umbilical in difficult situations
|
||||
variable_umbilical: False # should we untabgle the umbilical
|
||||
variable_umbilical_x: 15 # X umbilical position
|
||||
variable_umbilical_y: 15 # Y umbilical position
|
||||
|
||||
# location to park the toolhead
|
||||
variable_park_toolhead: False # Enable toolhead parking
|
||||
variable_parkposition_x: 75
|
||||
variable_parkposition_y: 75
|
||||
variable_parkposition_z: 30
|
||||
|
||||
# Do not modify below
|
||||
gcode:
|
||||
{% set Mx = printer['configfile'].config["stepper_x"]["position_max"]|float %}
|
||||
{% set My = printer['configfile'].config["stepper_y"]["position_max"]|float %}
|
||||
{% set Ox = printer['configfile'].config["probe"]["x_offset"]|float %}
|
||||
{% set Oy = printer['configfile'].config["probe"]["y_offset"]|float %}
|
||||
{% set Oz = printer['configfile'].config["probe"]["z_offset"]|float %}
|
||||
|
||||
# if docklocation_z is zero, use Home Z height for safety
|
||||
{% if docklocation_z == 0 %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=docklocation_z VALUE={ home_z_height }
|
||||
{% endif %}
|
||||
|
||||
# If x, y coordinates are set for z endstop, assign them
|
||||
{% if z_endstop_x != 0 or z_endstop_y != 0 %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_x VALUE={ z_endstop_x }
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_y VALUE={ z_endstop_y }
|
||||
|
||||
# if no x, y coordinates for z endstop, assume probe is endstop and move toolhead to center of bed
|
||||
{% else %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_x VALUE={ (Mx * 0.5) - Ox }
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_y VALUE={ (My * 0.5) - Oy }
|
||||
{% endif %}
|
||||
# This macro was provided by discord user Garrettwp to whom i give my thanks for sharing it with me.
|
||||
# I have tweaked it a lot.
|
||||
#
|
||||
# this macro is based on the great Annex magprobe dockable probe macros "#Originally developed by Mental, modified for better use on K-series printers by RyanG and Trails"
|
||||
# that macro can be found here https://github.com/Annex-Engineering/Annex-Engineering_Other_Printer_Mods/blob/master/All_Printers/Microswitch_Probe/Klipper_Macros/dockable_probe_macros.cfg
|
||||
#
|
||||
# by standing on the shoulders of giants, lets see if we can see further
|
||||
|
||||
[gcode_macro _Probe_Variables]
|
||||
variable_probe_attached: False
|
||||
variable_probe_state: False
|
||||
variable_probe_lock: False
|
||||
variable_z_endstop_x: 0
|
||||
variable_z_endstop_y: 0
|
||||
gcode:
|
||||
|
||||
|
||||
[gcode_macro _exit_point]
|
||||
gcode:
|
||||
{% set function = 'pre_' ~ params.FUNCTION %}
|
||||
{% set move = params.MOVE|default(0) %}
|
||||
# mandatory to save the new safe position
|
||||
M400
|
||||
RESTORE_GCODE_STATE NAME={function} MOVE={move}
|
||||
|
||||
|
||||
[gcode_macro _entry_point]
|
||||
gcode:
|
||||
{% set function = 'pre_' ~ params.FUNCTION %}
|
||||
# mandatory to save the new safe position
|
||||
M400
|
||||
SAVE_GCODE_STATE NAME={function}
|
||||
# removes the Z offset for better bed based docking
|
||||
SET_GCODE_OFFSET Z=0
|
||||
# all the macros initially assume absolute positioning
|
||||
G90
|
||||
|
||||
[gcode_macro _Homing_Variables]
|
||||
gcode:
|
||||
{% set R = params.RESET|default(0) %}
|
||||
{% if R %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ False }
|
||||
{% endif %}
|
||||
|
||||
# Attach probe and lock it
|
||||
[gcode_macro Attach_Probe_Lock]
|
||||
description: Attaches Klicky Probe, can only be docked after unlocking
|
||||
gcode:
|
||||
Attach_Probe
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ True }
|
||||
|
||||
# Dock probe and lock it
|
||||
[gcode_macro Dock_Probe_Unlock]
|
||||
description: Docks Klicky Probe even if it was locked
|
||||
gcode:
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ False }
|
||||
Dock_Probe
|
||||
|
||||
# Unlock Probe
|
||||
[gcode_macro Probe_Unlock]
|
||||
description: Unlocks Klicky Probe state
|
||||
gcode:
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ False }
|
||||
|
||||
# Lock Probe
|
||||
[gcode_macro Probe_Lock]
|
||||
description: Locks Klicky Probe state
|
||||
gcode:
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ True }
|
||||
|
||||
# Attach Probe Routine
|
||||
[gcode_macro Attach_Probe]
|
||||
description: Attaches Klicky Probe
|
||||
gcode:
|
||||
# Get probe attach status
|
||||
{% set P = printer["gcode_macro _Probe_Variables"].probe_attached %}
|
||||
{% set L = printer["gcode_macro _Probe_Variables"].probe_lock %}
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
# Get Docking location
|
||||
{% set Mx = printer["gcode_macro _User_Variables"].dockmove_x|default(0) %}
|
||||
{% set My = printer["gcode_macro _User_Variables"].dockmove_y|default(0) %}
|
||||
{% set Mz = printer["gcode_macro _User_Variables"].dockmove_z|default(0) %}
|
||||
{% set Dx = printer["gcode_macro _User_Variables"].docklocation_x %}
|
||||
{% set Dy = printer["gcode_macro _User_Variables"].docklocation_y %}
|
||||
{% set Dz = printer["gcode_macro _User_Variables"].docklocation_z %}
|
||||
{% set Ax = printer["gcode_macro _User_Variables"].attachmove_x|default(0) %}
|
||||
{% set Ay = printer["gcode_macro _User_Variables"].attachmove_y|default(0) %}
|
||||
{% set Az = printer["gcode_macro _User_Variables"].attachmove_z|default(0) %}
|
||||
{% set Gm = printer["gcode_macro _User_Variables"].gravity %}
|
||||
{% set Da = printer["gcode_macro _User_Variables"].dockarmslenght|default(0) %}
|
||||
# Safe Z for travel
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
#Set speed
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
|
||||
{% set Sd = printer["gcode_macro _User_Variables"].dock_speed * 60 %}
|
||||
{% set Sr = printer["gcode_macro _User_Variables"].release_speed * 60 %}
|
||||
{% set Sz = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
|
||||
|
||||
_entry_point function=Attach_Probe
|
||||
|
||||
#if there is no undock movement, assume older behavior
|
||||
{% if Mx == My == Mz == 0 %}
|
||||
{% set Mx = 40 %}
|
||||
{% endif %}
|
||||
#if there is no Attach movement, assume older behavior
|
||||
{% if Ax == Ay == Az == 0 %}
|
||||
{% set Ay = Da %}
|
||||
{% endif %}
|
||||
|
||||
# if x and y are not homed
|
||||
{% if not 'xy' in printer.toolhead.homed_axes %}
|
||||
{ action_raise_error("Must Home X and Y Axis First!") }
|
||||
|
||||
# If probe not attached and locked
|
||||
{% elif not P and not L %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Attaching Probe") }
|
||||
{% endif %}
|
||||
|
||||
{% if (not 'z' in printer.toolhead.homed_axes) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Resetting Z position to zero") }
|
||||
{% endif %}
|
||||
SET_KINEMATIC_POSITION Z=0
|
||||
{% if ('bed' in Gm) %} # checks if the bed or gantry move with gravity
|
||||
{% set Hzh = 0 %}
|
||||
{% elif ('gantry' in Gm) %} # checks if the bed or gantry move with gravity
|
||||
{% set Hzh = Hzh %}
|
||||
{% else %}
|
||||
{ action_raise_error("To avoid head crashes, configure Klicky probe gravity variable!") }
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
#prior to saving actual position, check if its necessary to move to a safe Z
|
||||
#that has enought overhead for the attached probe
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("moving to a safe Z distance") }
|
||||
{% endif %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
{% if (not 'z' in printer.toolhead.homed_axes) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Resetting Z position to zero") }
|
||||
{% endif %}
|
||||
SET_KINEMATIC_POSITION Z=0
|
||||
{% endif %}
|
||||
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
_Umbilical_Path
|
||||
|
||||
# Probe entry location
|
||||
G0 X{Dx|int - Ax|int} Y{Dy|int - Ay|int} F{St}
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz|int - Az|int} F{Sd}
|
||||
{% endif %}
|
||||
|
||||
# Drop Probe to Probe location
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz} F{Sd}
|
||||
{% endif %}
|
||||
G0 X{Dx} Y{Dy} F{Sd}
|
||||
|
||||
# Probe Attach
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz|int - Az|int} F{Sz}
|
||||
{% endif %}
|
||||
G0 X{Dx|int - Ax|int} Y{Dy|int - Ay|int} F{Sr}
|
||||
|
||||
#Go to Z safe distance
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
_Park_Toolhead
|
||||
|
||||
_CheckProbe action=attach
|
||||
|
||||
{% elif L %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Probe locked!") }
|
||||
{% endif %}
|
||||
|
||||
# Probe attached, do nothing
|
||||
_CheckProbe action=query
|
||||
|
||||
{% else %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Probe already attached!") }
|
||||
{% endif %}
|
||||
|
||||
# Probe attached, do nothing
|
||||
_CheckProbe action=query
|
||||
|
||||
{% endif %}
|
||||
_exit_point function=Attach_Probe
|
||||
|
||||
# Dock Probe Routine
|
||||
[gcode_macro Dock_Probe]
|
||||
description: Docks Klicky Probe
|
||||
gcode:
|
||||
# Get probe attach status
|
||||
{% set P = printer["gcode_macro _Probe_Variables"].probe_attached %}
|
||||
{% set L = printer["gcode_macro _Probe_Variables"].probe_lock %}
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
# Get Docking location
|
||||
{% set Mx = printer["gcode_macro _User_Variables"].dockmove_x|default(0) %}
|
||||
{% set My = printer["gcode_macro _User_Variables"].dockmove_y|default(0) %}
|
||||
{% set Mz = printer["gcode_macro _User_Variables"].dockmove_z|default(0) %}
|
||||
{% set Dx = printer["gcode_macro _User_Variables"].docklocation_x %}
|
||||
{% set Dy = printer["gcode_macro _User_Variables"].docklocation_y %}
|
||||
{% set Dz = printer["gcode_macro _User_Variables"].docklocation_z %}
|
||||
{% set Ax = printer["gcode_macro _User_Variables"].attachmove_x|default(0) %}
|
||||
{% set Ay = printer["gcode_macro _User_Variables"].attachmove_y|default(0) %}
|
||||
{% set Az = printer["gcode_macro _User_Variables"].attachmove_z|default(0) %}
|
||||
{% set Da = printer["gcode_macro _User_Variables"].dockarmslenght|default(0) %}
|
||||
# Safe Z for travel
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
# Set speed
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
|
||||
{% set Sd = printer["gcode_macro _User_Variables"].dock_speed * 60 %}
|
||||
{% set Sr = printer["gcode_macro _User_Variables"].release_speed * 60 %}
|
||||
{% set Sz = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
|
||||
|
||||
#if there is no undock movement, assume older behavior
|
||||
{% if Mx == My == Mz == 0 %}
|
||||
{% set Mx = 40 %}
|
||||
{% endif %}
|
||||
#if there is no Attach movement, assume older behavior
|
||||
{% if Ax == Ay == Az == 0 %}
|
||||
{% set Ay = Da %}
|
||||
{% endif %}
|
||||
|
||||
_entry_point function=Dock_Probe
|
||||
|
||||
{% if not 'xyz' in printer.toolhead.homed_axes %}
|
||||
{ action_raise_error("Must Home X, Y and Z Axis First!") }
|
||||
|
||||
# If probe not attached and not locked
|
||||
{% elif P and not L %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Docking Probe") }
|
||||
{% endif %}
|
||||
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
_Umbilical_Path
|
||||
|
||||
# Probe entry location
|
||||
G0 X{Dx|int - Ax|int} Y{Dy|int - Ay|int} F{St}
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz|int - Az|int} F{Sd}
|
||||
{% endif %}
|
||||
# Drop Probe to Probe location
|
||||
G0 X{Dx} Y{Dy} F{Sd}
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz} F{Sd}
|
||||
{% endif %}
|
||||
# Probe decoupling
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz|int + Mz|int} F{Sr}
|
||||
{% endif %}
|
||||
G0 X{Dx|int + Mx|int} Y{Dy|int + My|int} F{Sr}
|
||||
#Go to Z safe distance
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
_Park_Toolhead
|
||||
|
||||
G4 P1000
|
||||
_CheckProbe action=dock
|
||||
|
||||
{% elif L %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Probe locked!") }
|
||||
{% endif %}
|
||||
|
||||
# Probe docked, do nothing
|
||||
_CheckProbe action=query
|
||||
|
||||
{% else %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Probe already docked!") }
|
||||
{% endif %}
|
||||
|
||||
# Probe docked, do nothing
|
||||
_CheckProbe action=query
|
||||
|
||||
{% endif %}
|
||||
_exit_point function=Dock_Probe
|
||||
|
||||
# Probe Calibrate
|
||||
[gcode_macro PROBE_CALIBRATE]
|
||||
rename_existing: _PROBE_CALIBRATE
|
||||
description:Calibrate the probe's z_offset with klicky automount
|
||||
gcode:
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
{% set Sz = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed %}
|
||||
{% set Mx = printer['configfile'].config["stepper_x"]["position_max"]|float %}
|
||||
{% set My = printer['configfile'].config["stepper_y"]["position_max"]|float %}
|
||||
{% set Ox = printer['configfile'].config["probe"]["x_offset"]|float %}
|
||||
{% set Oy = printer['configfile'].config["probe"]["y_offset"]|float %}
|
||||
|
||||
{% if not 'xyz' in printer.toolhead.homed_axes %}
|
||||
{ action_raise_error("Must Home X, Y and Z Axis First!") }
|
||||
{% endif %}
|
||||
|
||||
_entry_point function=PROBE_CALIBRATE
|
||||
|
||||
# Go to Z safe distance before saving location in order to
|
||||
# avoid crashing the probe on the bed when coming back
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
#Protect against PROBE CALIBRATE performed from outside the bed
|
||||
{% if (printer['gcode_move'].position.y > (My - Oy)) or (printer['gcode_move'].position.x > (Mx - Ox)) or (printer['gcode_move'].position.x < Ox) %}
|
||||
{ action_raise_error("Must perform PROBE_CALIBRATE with the probe above the BED!!!") }
|
||||
{% endif%}
|
||||
M400 # mandatory to save the new safe position
|
||||
SAVE_GCODE_STATE NAME=_original_nozzle_location
|
||||
|
||||
_CheckProbe action=query
|
||||
Attach_Probe
|
||||
|
||||
# Restore nozzle location to probe the right place
|
||||
RESTORE_GCODE_STATE NAME=_original_nozzle_location MOVE=1 MOVE_SPEED={St}
|
||||
|
||||
_PROBE_CALIBRATE {% for p in params
|
||||
%}{'%s=%s ' % (p, params[p])}{%
|
||||
endfor %}
|
||||
|
||||
#store current nozzle location
|
||||
SAVE_GCODE_STATE NAME=_original_nozzle_location
|
||||
Dock_Probe
|
||||
|
||||
# Restore nozzle location again at the end
|
||||
RESTORE_GCODE_STATE NAME=_original_nozzle_location MOVE=1 MOVE_SPEED={St}
|
||||
_exit_point function=PROBE_CALIBRATE
|
||||
|
||||
# Probe Accuracy
|
||||
[gcode_macro PROBE_ACCURACY]
|
||||
rename_existing: _PROBE_ACCURACY
|
||||
description:Probe Z-height accuracy at current XY position with klicky automount
|
||||
gcode:
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
{% set Sz = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed %}
|
||||
{% set By = printer["gcode_macro _User_Variables"].max_bed_y %}
|
||||
{% set Oy = printer['configfile'].config["probe"]["y_offset"]|float %}
|
||||
|
||||
{% if not 'xyz' in printer.toolhead.homed_axes %}
|
||||
{ action_raise_error("Must Home X, Y and Z Axis First!") }
|
||||
{% endif %}
|
||||
|
||||
_entry_point function=PROBE_ACCURACY
|
||||
|
||||
# Go to Z safe distance before saving location in order to
|
||||
# avoid crashing the probe on the bed when coming back
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
#Protect against PROBE ACCURACY performed from outside the bed
|
||||
{% if (printer.toolhead.position.y > (By - Oy)) %}
|
||||
{ action_raise_error("Must perform PROBE_ACCURACY with the probe above the BED!!!") }
|
||||
{% endif%}
|
||||
M400 # mandatory to save the new safe position
|
||||
SAVE_GCODE_STATE NAME=_original_nozzle_location
|
||||
|
||||
_CheckProbe action=query
|
||||
Attach_Probe
|
||||
|
||||
# Restore nozzle location to probe the right place
|
||||
RESTORE_GCODE_STATE NAME=_original_nozzle_location MOVE=1 MOVE_SPEED={St}
|
||||
|
||||
_PROBE_ACCURACY {% for p in params
|
||||
%}{'%s=%s ' % (p, params[p])}{%
|
||||
endfor %}
|
||||
|
||||
#store current nozzle location
|
||||
SAVE_GCODE_STATE NAME=_original_nozzle_location
|
||||
|
||||
Dock_Probe
|
||||
|
||||
# Restore nozzle location again at the end
|
||||
RESTORE_GCODE_STATE NAME=_original_nozzle_location MOVE=1 MOVE_SPEED={St}
|
||||
_exit_point function=PROBE_ACCURACY
|
||||
|
||||
# enable to SET_KINEMATIC_POSITION for Z hop
|
||||
[force_move]
|
||||
enable_force_move: True
|
||||
|
||||
# Homeing Override
|
||||
[homing_override]
|
||||
axes: xyz
|
||||
gcode:
|
||||
# collect user state variables
|
||||
_User_Variables
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
{% set Gm = printer["gcode_macro _User_Variables"].gravity %}
|
||||
{% set Ax = printer["gcode_macro _User_Variables"].attachmove_x|default(0) %}
|
||||
{% set Ay = printer["gcode_macro _User_Variables"].attachmove_y|default(0) %}
|
||||
{% set Az = printer["gcode_macro _User_Variables"].attachmove_z|default(0) %}
|
||||
{% set Da = printer["gcode_macro _User_Variables"].dockarmslenght|default(0) %}
|
||||
|
||||
#if there is no Attach movement, assume older behavior
|
||||
{% if Ax == Ay == Az == 0 %}
|
||||
{% set Ay = Da %}
|
||||
{% endif %}
|
||||
|
||||
_CheckProbe action=query
|
||||
|
||||
# reset parameters
|
||||
{% set X, Y, Z = False, False, False %}
|
||||
|
||||
# which axes have been requested for homing
|
||||
{% if not 'X' in params
|
||||
and not 'Y' in params
|
||||
and not 'Z' in params %}
|
||||
|
||||
{% set X, Y, Z = True, True, True %}
|
||||
|
||||
{% else %}
|
||||
{% if 'X' in params %}
|
||||
{% set X = True %}
|
||||
{% endif %}
|
||||
|
||||
{% if 'Y' in params %}
|
||||
{% set Y = True %}
|
||||
{% endif %}
|
||||
|
||||
{% if 'Z' in params %}
|
||||
{% set Z = True %}
|
||||
{% endif %}
|
||||
|
||||
{% if 'X' in params
|
||||
and 'Y' in params
|
||||
and 'Z' in params %}
|
||||
# reset homing state variables
|
||||
# if homing all axes
|
||||
_Homing_Variables reset=1
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
_entry_point function=homing_override
|
||||
|
||||
# if Z is not homed, do not move the bed if it goes down
|
||||
{% if ('z' not in printer.toolhead.homed_axes) %}
|
||||
{% if ('bed' in Gm) %} # checks if the bed or gantry move with gravity
|
||||
{% set Hzh = 0 %}
|
||||
{% elif ('gantry' in Gm) %} # checks if the bed or gantry move with gravity
|
||||
{% set Hzh = Hzh %}
|
||||
{% else %}
|
||||
{ action_raise_error("To avoid head crashes, configure Klicky probe gravity variable!") }
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if Z %}
|
||||
{% if ('z' in printer.toolhead.homed_axes) %}
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Z too low, performing ZHOP") }
|
||||
{% endif %}
|
||||
G0 Z{Hzh} F1200
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Z not homed, forcing full G28") }
|
||||
{% endif %}
|
||||
SET_KINEMATIC_POSITION X=0 Y=0 Z=0
|
||||
G0 Z{Hzh} F600
|
||||
{% set X, Y, Z = True, True, True %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
# if the dock is oriented on the Y, first do Y endstop
|
||||
{% if Ay == 0 %}
|
||||
# Home y
|
||||
{% if Y %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Homing Y") }
|
||||
{% endif %}
|
||||
G28 Y0
|
||||
{% endif %}
|
||||
{% set Y = 0 %}
|
||||
{% endif %}
|
||||
|
||||
# Home x
|
||||
{% if X %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Homing X") }
|
||||
{% endif %}
|
||||
G28 X0
|
||||
{% endif %}
|
||||
|
||||
# Home y
|
||||
{% if Y %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Homing Y") }
|
||||
{% endif %}
|
||||
G28 Y0
|
||||
{% endif %}
|
||||
|
||||
# Home z
|
||||
{% if Z %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Homing Z") }
|
||||
{% endif %}
|
||||
|
||||
# if probe is configured as endstop, attach it, else dock the probe if attached
|
||||
{% if printer['configfile'].config["stepper_z"]["endstop_pin"] == 'probe:z_virtual_endstop' %}
|
||||
Attach_Probe
|
||||
{% else %}
|
||||
Dock_Probe
|
||||
{% endif %}
|
||||
|
||||
_Home_Z
|
||||
|
||||
# if probe is configured as endstop, dock it
|
||||
{% if printer['configfile'].config["stepper_z"]["endstop_pin"] == 'probe:z_virtual_endstop' %}
|
||||
Dock_Probe
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
_CheckProbe action=query
|
||||
|
||||
# park the toolhead
|
||||
_Park_Toolhead
|
||||
_exit_point function=homing_override
|
||||
|
||||
# umbilical path setup
|
||||
[gcode_macro _Umbilical_Path]
|
||||
gcode:
|
||||
{% set Ux = printer["gcode_macro _User_Variables"].umbilical_x %}
|
||||
{% set Uy = printer["gcode_macro _User_Variables"].umbilical_y %}
|
||||
{% set U = printer["gcode_macro _User_Variables"].umbilical %}
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
|
||||
|
||||
{% if U %}
|
||||
# Used to give the umbilical a better path to follow and coil properly if dock is tight in space
|
||||
_entry_point function=Umbilical_Path
|
||||
G0 X{Ux} Y{Uy} Z{Hzh} F{St}
|
||||
_exit_point function=Umbilical_Path
|
||||
{% endif %}
|
||||
|
||||
|
||||
# Home Z Routine
|
||||
[gcode_macro _Home_Z]
|
||||
gcode:
|
||||
{% set Zx = printer["gcode_macro _Probe_Variables"].z_endstop_x %}
|
||||
{% set Zy = printer["gcode_macro _Probe_Variables"].z_endstop_y %}
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
|
||||
{% set Sz = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
|
||||
|
||||
_entry_point function=Home_Z
|
||||
|
||||
# if x and y are not homed yet, raise error
|
||||
{% if not 'xy' in printer.toolhead.homed_axes %}
|
||||
{ action_raise_error("Must Home X and Y Axis First!") }
|
||||
|
||||
{% else %}
|
||||
{% if (not 'z' in printer.toolhead.homed_axes) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Resetting Z position to zero") }
|
||||
{% endif %}
|
||||
SET_KINEMATIC_POSITION Z=0
|
||||
{% endif %}
|
||||
|
||||
# move tool to safe homing position and home Z axis
|
||||
# location of z endstop
|
||||
G0 X{Zx} Y{Zy} F{St}
|
||||
G28 Z0
|
||||
G0 Z{Hzh} F{Sz}
|
||||
|
||||
{% endif %}
|
||||
_exit_point function=Home_Z
|
||||
|
||||
|
||||
# check to see if probe is where it is supposed to be after
|
||||
# attaching/docking maneuver and set homing error or shutdown
|
||||
[gcode_macro _CheckProbe]
|
||||
variable_probe_state: 0
|
||||
gcode:
|
||||
Query_Probe
|
||||
_SetProbeState action={ ACTION }
|
||||
|
||||
|
||||
# due to how templates are evaluated, we have query endstops in one
|
||||
# macro and call another macro to make decisions based on the result
|
||||
[gcode_macro _SetProbeState]
|
||||
gcode:
|
||||
{% set P = printer.probe.last_query %}
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
|
||||
# If triggered (true), probe not attached
|
||||
{% if P %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_attached VALUE={ False }
|
||||
|
||||
# If not triggered (false), probe attached
|
||||
{% else %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_attached VALUE={ True }
|
||||
{% endif %}
|
||||
|
||||
{% if params.ACTION == 'query' %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_state VALUE={ P }
|
||||
{% endif %}
|
||||
|
||||
# if probe fails to attach/detach
|
||||
# if not docked
|
||||
{% if (not P and params.ACTION == 'dock') %}
|
||||
{ action_raise_error("Probe dock failed!") }
|
||||
{% endif %}
|
||||
|
||||
# if not attached
|
||||
{% if P and params.ACTION == 'attach' %}
|
||||
{ action_raise_error("Probe attach failed!") }
|
||||
{% endif %}
|
||||
|
||||
# Park Toolhead Routine
|
||||
[gcode_macro _Park_Toolhead]
|
||||
gcode:
|
||||
{% set P = printer["gcode_macro _User_Variables"].park_toolhead %}
|
||||
{% set Px = printer["gcode_macro _User_Variables"].parkposition_x %}
|
||||
{% set Py = printer["gcode_macro _User_Variables"].parkposition_y %}
|
||||
{% set Pz = printer["gcode_macro _User_Variables"].parkposition_z %}
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
|
||||
_entry_point function=Park_Toolhead
|
||||
|
||||
{% if (P and 'xyz' in printer.toolhead.homed_axes) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Parking Toolhead") }
|
||||
{% endif %}
|
||||
G0 X{Px} Y{Py} Z{Pz} F{St}
|
||||
{% endif %}
|
||||
_exit_point function=Park_Toolhead
|
||||
|
||||
|
||||
# Z Tilt Adjust
|
||||
[gcode_macro Z_TILT_ADJUST]
|
||||
rename_existing: _Z_TILT_ADJUST
|
||||
description:
|
||||
gcode:
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Z Tilt Adjust") }
|
||||
{% endif %}
|
||||
|
||||
_CheckProbe action=query
|
||||
Attach_Probe
|
||||
|
||||
_Z_TILT_ADJUST {% for p in params
|
||||
%}{'%s=%s ' % (p, params[p])}{%
|
||||
endfor %}
|
||||
Dock_Probe
|
||||
G28 Z0
|
||||
|
||||
[gcode_macro BED_MESH_CALIBRATE]
|
||||
rename_existing: _BED_MESH_CALIBRATE
|
||||
description: Perform Mesh Bed Leveling with klicky automount
|
||||
gcode:
|
||||
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Bed Mesh Calibrate") }
|
||||
{% endif %}
|
||||
|
||||
_CheckProbe action=query
|
||||
Attach_Probe
|
||||
|
||||
_BED_MESH_CALIBRATE {% for p in params
|
||||
%}{'%s=%s ' % (p, params[p])}{%
|
||||
endfor %}
|
||||
|
||||
Dock_Probe
|
||||
|
||||
## Screws Tilt Adjust
|
||||
#[gcode_macro SCREWS_TILT_CALCULATE]
|
||||
#rename_existing: _SCREWS_TILT_CALCULATE
|
||||
#description:
|
||||
#gcode:
|
||||
# {% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
# {% if V %}
|
||||
# { action_respond_info("Screws Tilt Adjust") }
|
||||
# {% endif %}
|
||||
#
|
||||
# _CheckProbe action=query
|
||||
# Attach_Probe
|
||||
#
|
||||
# _SCREWS_TILT_CALCULATE {% for p in params
|
||||
# %}{'%s=%s ' % (p, params[p])}{%
|
||||
# endfor %}
|
||||
#
|
||||
# Dock_Probe
|
||||
|
|
@ -1,773 +0,0 @@
|
|||
# This macro was provided by discord user Garrettwp to whom i give my thanks for sharing it with me.
|
||||
# I have tweaked it a lot.
|
||||
#
|
||||
# this macro is based on the great Annex magprobe dockable probe macros "#Originally developed by Mental, modified for better use on K-series printers by RyanG and Trails"
|
||||
# that macro can be found here https://github.com/Annex-Engineering/Annex-Engineering_Other_Printer_Mods/blob/master/All_Printers/Microswitch_Probe/Klipper_Macros/dockable_probe_macros.cfg
|
||||
#
|
||||
# by standing on the shoulders of giants, lets see if we can see further
|
||||
|
||||
[gcode_macro _User_Variables]
|
||||
variable_verbose: True # Enable verbose output
|
||||
variable_travel_speed: 200 # how fast all other travel moves will be performed when running these macros
|
||||
variable_dock_speed: 50 # how fast should the toolhead move when docking the probe for the final movement
|
||||
variable_release_speed: 75 # how fast should the toolhead move to release the hold of the magnets after docking
|
||||
variable_z_drop_speed: 20 # how fast the z will lower when moving to the z location to clear the probe
|
||||
variable_home_z_height: 10 # Z when homing
|
||||
|
||||
#bed type
|
||||
variable_gravity: 'bed' # What goes down with gravity, bed or gantry?
|
||||
variable_max_bed_y: 250 # maximum Bed size avoids doing a probe_accuracy outside the bed
|
||||
|
||||
# if a separate Z endstop switch is in
|
||||
# use, specify the coordinates of the switch here (Voron).
|
||||
# Set to 0 to have the probe move to center of bed
|
||||
variable_z_endstop_x: 1000
|
||||
variable_z_endstop_y: 1000
|
||||
|
||||
#dock location
|
||||
variable_docklocation_x: 1000 # X Dock position
|
||||
variable_docklocation_y: 1000 # Y Dock position
|
||||
variable_docklocation_z: -128 # Z dock position (-128 for a gantry mount)
|
||||
variable_dockarmslenght: 30 # Dock arms lenght, toolhead movement necessary to clear the dock arms
|
||||
|
||||
#Umbilical to help untangle the umbilical in difficult situations
|
||||
variable_umbilical: False # should we untabgle the umbilical
|
||||
variable_umbilical_x: 15 # X umbilical position
|
||||
variable_umbilical_y: 15 # Y umbilical position
|
||||
|
||||
# location to park the toolhead
|
||||
variable_park_toolhead: False # Enable toolhead parking
|
||||
variable_parkposition_x: 75
|
||||
variable_parkposition_y: 75
|
||||
variable_parkposition_z: 30
|
||||
|
||||
# Do not modify below
|
||||
gcode:
|
||||
{% set Mx = printer['configfile'].config["stepper_x"]["position_max"]|float %}
|
||||
{% set My = printer['configfile'].config["stepper_y"]["position_max"]|float %}
|
||||
{% set Ox = printer['configfile'].config["probe"]["x_offset"]|float %}
|
||||
{% set Oy = printer['configfile'].config["probe"]["y_offset"]|float %}
|
||||
{% set Oz = printer['configfile'].config["probe"]["z_offset"]|float %}
|
||||
|
||||
# if docklocation_z is zero, use Home Z height for safety
|
||||
{% if docklocation_z == 0 %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=docklocation_z VALUE={ home_z_height }
|
||||
{% endif %}
|
||||
|
||||
# If x, y coordinates are set for z endstop, assign them
|
||||
{% if z_endstop_x != 0 or z_endstop_y != 0 %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_x VALUE={ z_endstop_x }
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_y VALUE={ z_endstop_y }
|
||||
|
||||
# if no x, y coordinates for z endstop, assume probe is endstop and move toolhead to center of bed
|
||||
{% else %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_x VALUE={ (Mx * 0.5) - Ox }
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_y VALUE={ (My * 0.5) - Oy }
|
||||
{% endif %}
|
||||
# This macro was provided by discord user Garrettwp to whom i give my thanks for sharing it with me.
|
||||
# I have tweaked it a lot.
|
||||
#
|
||||
# this macro is based on the great Annex magprobe dockable probe macros "#Originally developed by Mental, modified for better use on K-series printers by RyanG and Trails"
|
||||
# that macro can be found here https://github.com/Annex-Engineering/Annex-Engineering_Other_Printer_Mods/blob/master/All_Printers/Microswitch_Probe/Klipper_Macros/dockable_probe_macros.cfg
|
||||
#
|
||||
# by standing on the shoulders of giants, lets see if we can see further
|
||||
|
||||
[gcode_macro _Probe_Variables]
|
||||
variable_probe_attached: False
|
||||
variable_probe_state: False
|
||||
variable_probe_lock: False
|
||||
variable_z_endstop_x: 0
|
||||
variable_z_endstop_y: 0
|
||||
gcode:
|
||||
|
||||
|
||||
[gcode_macro _exit_point]
|
||||
gcode:
|
||||
{% set function = 'pre_' ~ params.FUNCTION %}
|
||||
{% set move = params.MOVE|default(0) %}
|
||||
# mandatory to save the new safe position
|
||||
M400
|
||||
RESTORE_GCODE_STATE NAME={function} MOVE={move}
|
||||
|
||||
|
||||
[gcode_macro _entry_point]
|
||||
gcode:
|
||||
{% set function = 'pre_' ~ params.FUNCTION %}
|
||||
# mandatory to save the new safe position
|
||||
M400
|
||||
SAVE_GCODE_STATE NAME={function}
|
||||
# removes the Z offset for better bed based docking
|
||||
SET_GCODE_OFFSET Z=0
|
||||
# all the macros initially assume absolute positioning
|
||||
G90
|
||||
|
||||
[gcode_macro _Homing_Variables]
|
||||
gcode:
|
||||
{% set R = params.RESET|default(0) %}
|
||||
{% if R %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ False }
|
||||
{% endif %}
|
||||
|
||||
# Attach probe and lock it
|
||||
[gcode_macro Attach_Probe_Lock]
|
||||
description: Attaches Klicky Probe, can only be docked after unlocking
|
||||
gcode:
|
||||
Attach_Probe
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ True }
|
||||
|
||||
# Dock probe and lock it
|
||||
[gcode_macro Dock_Probe_Unlock]
|
||||
description: Docks Klicky Probe even if it was locked
|
||||
gcode:
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ False }
|
||||
Dock_Probe
|
||||
|
||||
# Unlock Probe
|
||||
[gcode_macro Probe_Unlock]
|
||||
description: Unlocks Klicky Probe state
|
||||
gcode:
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ False }
|
||||
|
||||
# Lock Probe
|
||||
[gcode_macro Probe_Lock]
|
||||
description: Locks Klicky Probe state
|
||||
gcode:
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ True }
|
||||
|
||||
# Attach Probe Routine
|
||||
[gcode_macro Attach_Probe]
|
||||
description: Attaches Klicky Probe
|
||||
gcode:
|
||||
# Get probe attach status
|
||||
{% set P = printer["gcode_macro _Probe_Variables"].probe_attached %}
|
||||
{% set L = printer["gcode_macro _Probe_Variables"].probe_lock %}
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
# Get Docking location
|
||||
{% set Mx = printer["gcode_macro _User_Variables"].dockmove_x|default(0) %}
|
||||
{% set My = printer["gcode_macro _User_Variables"].dockmove_y|default(0) %}
|
||||
{% set Mz = printer["gcode_macro _User_Variables"].dockmove_z|default(0) %}
|
||||
{% set Dx = printer["gcode_macro _User_Variables"].docklocation_x %}
|
||||
{% set Dy = printer["gcode_macro _User_Variables"].docklocation_y %}
|
||||
{% set Dz = printer["gcode_macro _User_Variables"].docklocation_z %}
|
||||
{% set Ax = printer["gcode_macro _User_Variables"].attachmove_x|default(0) %}
|
||||
{% set Ay = printer["gcode_macro _User_Variables"].attachmove_y|default(0) %}
|
||||
{% set Az = printer["gcode_macro _User_Variables"].attachmove_z|default(0) %}
|
||||
{% set Gm = printer["gcode_macro _User_Variables"].gravity %}
|
||||
{% set Da = printer["gcode_macro _User_Variables"].dockarmslenght|default(0) %}
|
||||
# Safe Z for travel
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
#Set speed
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
|
||||
{% set Sd = printer["gcode_macro _User_Variables"].dock_speed * 60 %}
|
||||
{% set Sr = printer["gcode_macro _User_Variables"].release_speed * 60 %}
|
||||
{% set Sz = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
|
||||
|
||||
_entry_point function=Attach_Probe
|
||||
|
||||
#if there is no undock movement, assume older behavior
|
||||
{% if Mx == My == Mz == 0 %}
|
||||
{% set Mx = 40 %}
|
||||
{% endif %}
|
||||
#if there is no Attach movement, assume older behavior
|
||||
{% if Ax == Ay == Az == 0 %}
|
||||
{% set Ay = Da %}
|
||||
{% endif %}
|
||||
|
||||
# if x and y are not homed
|
||||
{% if not 'xy' in printer.toolhead.homed_axes %}
|
||||
{ action_raise_error("Must Home X and Y Axis First!") }
|
||||
|
||||
# If probe not attached and locked
|
||||
{% elif not P and not L %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Attaching Probe") }
|
||||
{% endif %}
|
||||
|
||||
{% if (not 'z' in printer.toolhead.homed_axes) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Resetting Z position to zero") }
|
||||
{% endif %}
|
||||
SET_KINEMATIC_POSITION Z=0
|
||||
{% if ('bed' in Gm) %} # checks if the bed or gantry move with gravity
|
||||
{% set Hzh = 0 %}
|
||||
{% elif ('gantry' in Gm) %} # checks if the bed or gantry move with gravity
|
||||
{% set Hzh = Hzh %}
|
||||
{% else %}
|
||||
{ action_raise_error("To avoid head crashes, configure Klicky probe gravity variable!") }
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
#prior to saving actual position, check if its necessary to move to a safe Z
|
||||
#that has enought overhead for the attached probe
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("moving to a safe Z distance") }
|
||||
{% endif %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
{% if (not 'z' in printer.toolhead.homed_axes) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Resetting Z position to zero") }
|
||||
{% endif %}
|
||||
SET_KINEMATIC_POSITION Z=0
|
||||
{% endif %}
|
||||
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
_Umbilical_Path
|
||||
|
||||
# Probe entry location
|
||||
G0 X{Dx|int - Ax|int} Y{Dy|int - Ay|int} F{St}
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz|int - Az|int} F{Sd}
|
||||
{% endif %}
|
||||
|
||||
# Drop Probe to Probe location
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz} F{Sd}
|
||||
{% endif %}
|
||||
G0 X{Dx} Y{Dy} F{Sd}
|
||||
|
||||
# Probe Attach
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz|int - Az|int} F{Sz}
|
||||
{% endif %}
|
||||
G0 X{Dx|int - Ax|int} Y{Dy|int - Ay|int} F{Sr}
|
||||
|
||||
#Go to Z safe distance
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
_Park_Toolhead
|
||||
|
||||
_CheckProbe action=attach
|
||||
|
||||
{% elif L %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Probe locked!") }
|
||||
{% endif %}
|
||||
|
||||
# Probe attached, do nothing
|
||||
_CheckProbe action=query
|
||||
|
||||
{% else %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Probe already attached!") }
|
||||
{% endif %}
|
||||
|
||||
# Probe attached, do nothing
|
||||
_CheckProbe action=query
|
||||
|
||||
{% endif %}
|
||||
_exit_point function=Attach_Probe
|
||||
|
||||
# Dock Probe Routine
|
||||
[gcode_macro Dock_Probe]
|
||||
description: Docks Klicky Probe
|
||||
gcode:
|
||||
# Get probe attach status
|
||||
{% set P = printer["gcode_macro _Probe_Variables"].probe_attached %}
|
||||
{% set L = printer["gcode_macro _Probe_Variables"].probe_lock %}
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
# Get Docking location
|
||||
{% set Mx = printer["gcode_macro _User_Variables"].dockmove_x|default(0) %}
|
||||
{% set My = printer["gcode_macro _User_Variables"].dockmove_y|default(0) %}
|
||||
{% set Mz = printer["gcode_macro _User_Variables"].dockmove_z|default(0) %}
|
||||
{% set Dx = printer["gcode_macro _User_Variables"].docklocation_x %}
|
||||
{% set Dy = printer["gcode_macro _User_Variables"].docklocation_y %}
|
||||
{% set Dz = printer["gcode_macro _User_Variables"].docklocation_z %}
|
||||
{% set Ax = printer["gcode_macro _User_Variables"].attachmove_x|default(0) %}
|
||||
{% set Ay = printer["gcode_macro _User_Variables"].attachmove_y|default(0) %}
|
||||
{% set Az = printer["gcode_macro _User_Variables"].attachmove_z|default(0) %}
|
||||
{% set Da = printer["gcode_macro _User_Variables"].dockarmslenght|default(0) %}
|
||||
# Safe Z for travel
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
# Set speed
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
|
||||
{% set Sd = printer["gcode_macro _User_Variables"].dock_speed * 60 %}
|
||||
{% set Sr = printer["gcode_macro _User_Variables"].release_speed * 60 %}
|
||||
{% set Sz = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
|
||||
|
||||
#if there is no undock movement, assume older behavior
|
||||
{% if Mx == My == Mz == 0 %}
|
||||
{% set Mx = 40 %}
|
||||
{% endif %}
|
||||
#if there is no Attach movement, assume older behavior
|
||||
{% if Ax == Ay == Az == 0 %}
|
||||
{% set Ay = Da %}
|
||||
{% endif %}
|
||||
|
||||
_entry_point function=Dock_Probe
|
||||
|
||||
{% if not 'xyz' in printer.toolhead.homed_axes %}
|
||||
{ action_raise_error("Must Home X, Y and Z Axis First!") }
|
||||
|
||||
# If probe not attached and not locked
|
||||
{% elif P and not L %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Docking Probe") }
|
||||
{% endif %}
|
||||
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
_Umbilical_Path
|
||||
|
||||
# Probe entry location
|
||||
G0 X{Dx|int - Ax|int} Y{Dy|int - Ay|int} F{St}
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz|int - Az|int} F{Sd}
|
||||
{% endif %}
|
||||
# Drop Probe to Probe location
|
||||
G0 X{Dx} Y{Dy} F{Sd}
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz} F{Sd}
|
||||
{% endif %}
|
||||
# Probe decoupling
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz|int + Mz|int} F{Sr}
|
||||
{% endif %}
|
||||
G0 X{Dx|int + Mx|int} Y{Dy|int + My|int} F{Sr}
|
||||
#Go to Z safe distance
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
_Park_Toolhead
|
||||
|
||||
G4 P1000
|
||||
_CheckProbe action=dock
|
||||
|
||||
{% elif L %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Probe locked!") }
|
||||
{% endif %}
|
||||
|
||||
# Probe docked, do nothing
|
||||
_CheckProbe action=query
|
||||
|
||||
{% else %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Probe already docked!") }
|
||||
{% endif %}
|
||||
|
||||
# Probe docked, do nothing
|
||||
_CheckProbe action=query
|
||||
|
||||
{% endif %}
|
||||
_exit_point function=Dock_Probe
|
||||
|
||||
# Probe Calibrate
|
||||
[gcode_macro PROBE_CALIBRATE]
|
||||
rename_existing: _PROBE_CALIBRATE
|
||||
description:Calibrate the probe's z_offset with klicky automount
|
||||
gcode:
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
{% set Sz = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed %}
|
||||
{% set Mx = printer['configfile'].config["stepper_x"]["position_max"]|float %}
|
||||
{% set My = printer['configfile'].config["stepper_y"]["position_max"]|float %}
|
||||
{% set Ox = printer['configfile'].config["probe"]["x_offset"]|float %}
|
||||
{% set Oy = printer['configfile'].config["probe"]["y_offset"]|float %}
|
||||
|
||||
{% if not 'xyz' in printer.toolhead.homed_axes %}
|
||||
{ action_raise_error("Must Home X, Y and Z Axis First!") }
|
||||
{% endif %}
|
||||
|
||||
_entry_point function=PROBE_CALIBRATE
|
||||
|
||||
# Go to Z safe distance before saving location in order to
|
||||
# avoid crashing the probe on the bed when coming back
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
#Protect against PROBE CALIBRATE performed from outside the bed
|
||||
{% if (printer['gcode_move'].position.y > (My - Oy)) or (printer['gcode_move'].position.x > (Mx - Ox)) or (printer['gcode_move'].position.x < Ox) %}
|
||||
{ action_raise_error("Must perform PROBE_CALIBRATE with the probe above the BED!!!") }
|
||||
{% endif%}
|
||||
M400 # mandatory to save the new safe position
|
||||
SAVE_GCODE_STATE NAME=_original_nozzle_location
|
||||
|
||||
_CheckProbe action=query
|
||||
Attach_Probe
|
||||
|
||||
# Restore nozzle location to probe the right place
|
||||
RESTORE_GCODE_STATE NAME=_original_nozzle_location MOVE=1 MOVE_SPEED={St}
|
||||
|
||||
_PROBE_CALIBRATE {% for p in params
|
||||
%}{'%s=%s ' % (p, params[p])}{%
|
||||
endfor %}
|
||||
|
||||
#store current nozzle location
|
||||
SAVE_GCODE_STATE NAME=_original_nozzle_location
|
||||
Dock_Probe
|
||||
|
||||
# Restore nozzle location again at the end
|
||||
RESTORE_GCODE_STATE NAME=_original_nozzle_location MOVE=1 MOVE_SPEED={St}
|
||||
_exit_point function=PROBE_CALIBRATE
|
||||
|
||||
# Probe Accuracy
|
||||
[gcode_macro PROBE_ACCURACY]
|
||||
rename_existing: _PROBE_ACCURACY
|
||||
description:Probe Z-height accuracy at current XY position with klicky automount
|
||||
gcode:
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
{% set Sz = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed %}
|
||||
{% set By = printer["gcode_macro _User_Variables"].max_bed_y %}
|
||||
{% set Oy = printer['configfile'].config["probe"]["y_offset"]|float %}
|
||||
|
||||
{% if not 'xyz' in printer.toolhead.homed_axes %}
|
||||
{ action_raise_error("Must Home X, Y and Z Axis First!") }
|
||||
{% endif %}
|
||||
|
||||
_entry_point function=PROBE_ACCURACY
|
||||
|
||||
# Go to Z safe distance before saving location in order to
|
||||
# avoid crashing the probe on the bed when coming back
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
#Protect against PROBE ACCURACY performed from outside the bed
|
||||
{% if (printer.toolhead.position.y > (By - Oy)) %}
|
||||
{ action_raise_error("Must perform PROBE_ACCURACY with the probe above the BED!!!") }
|
||||
{% endif%}
|
||||
M400 # mandatory to save the new safe position
|
||||
SAVE_GCODE_STATE NAME=_original_nozzle_location
|
||||
|
||||
_CheckProbe action=query
|
||||
Attach_Probe
|
||||
|
||||
# Restore nozzle location to probe the right place
|
||||
RESTORE_GCODE_STATE NAME=_original_nozzle_location MOVE=1 MOVE_SPEED={St}
|
||||
|
||||
_PROBE_ACCURACY {% for p in params
|
||||
%}{'%s=%s ' % (p, params[p])}{%
|
||||
endfor %}
|
||||
|
||||
#store current nozzle location
|
||||
SAVE_GCODE_STATE NAME=_original_nozzle_location
|
||||
|
||||
Dock_Probe
|
||||
|
||||
# Restore nozzle location again at the end
|
||||
RESTORE_GCODE_STATE NAME=_original_nozzle_location MOVE=1 MOVE_SPEED={St}
|
||||
_exit_point function=PROBE_ACCURACY
|
||||
|
||||
# enable to SET_KINEMATIC_POSITION for Z hop
|
||||
[force_move]
|
||||
enable_force_move: True
|
||||
|
||||
# Homeing Override
|
||||
[homing_override]
|
||||
axes: xyz
|
||||
gcode:
|
||||
# collect user state variables
|
||||
_User_Variables
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
{% set Gm = printer["gcode_macro _User_Variables"].gravity %}
|
||||
{% set Ax = printer["gcode_macro _User_Variables"].attachmove_x|default(0) %}
|
||||
{% set Ay = printer["gcode_macro _User_Variables"].attachmove_y|default(0) %}
|
||||
{% set Az = printer["gcode_macro _User_Variables"].attachmove_z|default(0) %}
|
||||
{% set Da = printer["gcode_macro _User_Variables"].dockarmslenght|default(0) %}
|
||||
|
||||
#if there is no Attach movement, assume older behavior
|
||||
{% if Ax == Ay == Az == 0 %}
|
||||
{% set Ay = Da %}
|
||||
{% endif %}
|
||||
|
||||
_CheckProbe action=query
|
||||
|
||||
# reset parameters
|
||||
{% set X, Y, Z = False, False, False %}
|
||||
|
||||
# which axes have been requested for homing
|
||||
{% if not 'X' in params
|
||||
and not 'Y' in params
|
||||
and not 'Z' in params %}
|
||||
|
||||
{% set X, Y, Z = True, True, True %}
|
||||
|
||||
{% else %}
|
||||
{% if 'X' in params %}
|
||||
{% set X = True %}
|
||||
{% endif %}
|
||||
|
||||
{% if 'Y' in params %}
|
||||
{% set Y = True %}
|
||||
{% endif %}
|
||||
|
||||
{% if 'Z' in params %}
|
||||
{% set Z = True %}
|
||||
{% endif %}
|
||||
|
||||
{% if 'X' in params
|
||||
and 'Y' in params
|
||||
and 'Z' in params %}
|
||||
# reset homing state variables
|
||||
# if homing all axes
|
||||
_Homing_Variables reset=1
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
_entry_point function=homing_override
|
||||
|
||||
# if Z is not homed, do not move the bed if it goes down
|
||||
{% if ('z' not in printer.toolhead.homed_axes) %}
|
||||
{% if ('bed' in Gm) %} # checks if the bed or gantry move with gravity
|
||||
{% set Hzh = 0 %}
|
||||
{% elif ('gantry' in Gm) %} # checks if the bed or gantry move with gravity
|
||||
{% set Hzh = Hzh %}
|
||||
{% else %}
|
||||
{ action_raise_error("To avoid head crashes, configure Klicky probe gravity variable!") }
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if Z %}
|
||||
{% if ('z' in printer.toolhead.homed_axes) %}
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Z too low, performing ZHOP") }
|
||||
{% endif %}
|
||||
G0 Z{Hzh} F1200
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Z not homed, forcing full G28") }
|
||||
{% endif %}
|
||||
SET_KINEMATIC_POSITION X=0 Y=0 Z=0
|
||||
G0 Z{Hzh} F600
|
||||
{% set X, Y, Z = True, True, True %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
# if the dock is oriented on the Y, first do Y endstop
|
||||
{% if Ay == 0 %}
|
||||
# Home y
|
||||
{% if Y %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Homing Y") }
|
||||
{% endif %}
|
||||
G28 Y0
|
||||
{% endif %}
|
||||
{% set Y = 0 %}
|
||||
{% endif %}
|
||||
|
||||
# Home x
|
||||
{% if X %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Homing X") }
|
||||
{% endif %}
|
||||
G28 X0
|
||||
{% endif %}
|
||||
|
||||
# Home y
|
||||
{% if Y %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Homing Y") }
|
||||
{% endif %}
|
||||
G28 Y0
|
||||
{% endif %}
|
||||
|
||||
# Home z
|
||||
{% if Z %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Homing Z") }
|
||||
{% endif %}
|
||||
|
||||
# if probe is configured as endstop, attach it, else dock the probe if attached
|
||||
{% if printer['configfile'].config["stepper_z"]["endstop_pin"] == 'probe:z_virtual_endstop' %}
|
||||
Attach_Probe
|
||||
{% else %}
|
||||
Dock_Probe
|
||||
{% endif %}
|
||||
|
||||
_Home_Z
|
||||
|
||||
# if probe is configured as endstop, dock it
|
||||
{% if printer['configfile'].config["stepper_z"]["endstop_pin"] == 'probe:z_virtual_endstop' %}
|
||||
Dock_Probe
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
_CheckProbe action=query
|
||||
|
||||
# park the toolhead
|
||||
_Park_Toolhead
|
||||
_exit_point function=homing_override
|
||||
|
||||
# umbilical path setup
|
||||
[gcode_macro _Umbilical_Path]
|
||||
gcode:
|
||||
{% set Ux = printer["gcode_macro _User_Variables"].umbilical_x %}
|
||||
{% set Uy = printer["gcode_macro _User_Variables"].umbilical_y %}
|
||||
{% set U = printer["gcode_macro _User_Variables"].umbilical %}
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
|
||||
|
||||
{% if U %}
|
||||
# Used to give the umbilical a better path to follow and coil properly if dock is tight in space
|
||||
_entry_point function=Umbilical_Path
|
||||
G0 X{Ux} Y{Uy} Z{Hzh} F{St}
|
||||
_exit_point function=Umbilical_Path
|
||||
{% endif %}
|
||||
|
||||
|
||||
# Home Z Routine
|
||||
[gcode_macro _Home_Z]
|
||||
gcode:
|
||||
{% set Zx = printer["gcode_macro _Probe_Variables"].z_endstop_x %}
|
||||
{% set Zy = printer["gcode_macro _Probe_Variables"].z_endstop_y %}
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
|
||||
{% set Sz = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
|
||||
|
||||
_entry_point function=Home_Z
|
||||
|
||||
# if x and y are not homed yet, raise error
|
||||
{% if not 'xy' in printer.toolhead.homed_axes %}
|
||||
{ action_raise_error("Must Home X and Y Axis First!") }
|
||||
|
||||
{% else %}
|
||||
{% if (not 'z' in printer.toolhead.homed_axes) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Resetting Z position to zero") }
|
||||
{% endif %}
|
||||
SET_KINEMATIC_POSITION Z=0
|
||||
{% endif %}
|
||||
|
||||
# move tool to safe homing position and home Z axis
|
||||
# location of z endstop
|
||||
G0 X{Zx} Y{Zy} F{St}
|
||||
G28 Z0
|
||||
G0 Z{Hzh} F{Sz}
|
||||
|
||||
{% endif %}
|
||||
_exit_point function=Home_Z
|
||||
|
||||
|
||||
# check to see if probe is where it is supposed to be after
|
||||
# attaching/docking maneuver and set homing error or shutdown
|
||||
[gcode_macro _CheckProbe]
|
||||
variable_probe_state: 0
|
||||
gcode:
|
||||
Query_Probe
|
||||
_SetProbeState action={ ACTION }
|
||||
|
||||
|
||||
# due to how templates are evaluated, we have query endstops in one
|
||||
# macro and call another macro to make decisions based on the result
|
||||
[gcode_macro _SetProbeState]
|
||||
gcode:
|
||||
{% set P = printer.probe.last_query %}
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
|
||||
# If triggered (true), probe not attached
|
||||
{% if P %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_attached VALUE={ False }
|
||||
|
||||
# If not triggered (false), probe attached
|
||||
{% else %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_attached VALUE={ True }
|
||||
{% endif %}
|
||||
|
||||
{% if params.ACTION == 'query' %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_state VALUE={ P }
|
||||
{% endif %}
|
||||
|
||||
# if probe fails to attach/detach
|
||||
# if not docked
|
||||
{% if (not P and params.ACTION == 'dock') %}
|
||||
{ action_raise_error("Probe dock failed!") }
|
||||
{% endif %}
|
||||
|
||||
# if not attached
|
||||
{% if P and params.ACTION == 'attach' %}
|
||||
{ action_raise_error("Probe attach failed!") }
|
||||
{% endif %}
|
||||
|
||||
# Park Toolhead Routine
|
||||
[gcode_macro _Park_Toolhead]
|
||||
gcode:
|
||||
{% set P = printer["gcode_macro _User_Variables"].park_toolhead %}
|
||||
{% set Px = printer["gcode_macro _User_Variables"].parkposition_x %}
|
||||
{% set Py = printer["gcode_macro _User_Variables"].parkposition_y %}
|
||||
{% set Pz = printer["gcode_macro _User_Variables"].parkposition_z %}
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
|
||||
_entry_point function=Park_Toolhead
|
||||
|
||||
{% if (P and 'xyz' in printer.toolhead.homed_axes) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Parking Toolhead") }
|
||||
{% endif %}
|
||||
G0 X{Px} Y{Py} Z{Pz} F{St}
|
||||
{% endif %}
|
||||
_exit_point function=Park_Toolhead
|
||||
|
||||
|
||||
## Z Tilt Adjust
|
||||
#[gcode_macro Z_TILT_ADJUST]
|
||||
#rename_existing: _Z_TILT_ADJUST
|
||||
#description:
|
||||
#gcode:
|
||||
# {% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
# {% if V %}
|
||||
# { action_respond_info("Z Tilt Adjust") }
|
||||
# {% endif %}
|
||||
#
|
||||
# _CheckProbe action=query
|
||||
# Attach_Probe
|
||||
#
|
||||
# _Z_TILT_ADJUST {% for p in params
|
||||
# %}{'%s=%s ' % (p, params[p])}{%
|
||||
# endfor %}
|
||||
# Dock_Probe
|
||||
# G28 Z0
|
||||
|
||||
[gcode_macro BED_MESH_CALIBRATE]
|
||||
rename_existing: _BED_MESH_CALIBRATE
|
||||
description: Perform Mesh Bed Leveling with klicky automount
|
||||
gcode:
|
||||
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Bed Mesh Calibrate") }
|
||||
{% endif %}
|
||||
|
||||
_CheckProbe action=query
|
||||
Attach_Probe
|
||||
|
||||
_BED_MESH_CALIBRATE {% for p in params
|
||||
%}{'%s=%s ' % (p, params[p])}{%
|
||||
endfor %}
|
||||
|
||||
Dock_Probe
|
||||
|
||||
# Screws Tilt Adjust
|
||||
[gcode_macro SCREWS_TILT_CALCULATE]
|
||||
rename_existing: _SCREWS_TILT_CALCULATE
|
||||
description:
|
||||
gcode:
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Screws Tilt Adjust") }
|
||||
{% endif %}
|
||||
|
||||
_CheckProbe action=query
|
||||
Attach_Probe
|
||||
|
||||
_SCREWS_TILT_CALCULATE {% for p in params
|
||||
%}{'%s=%s ' % (p, params[p])}{%
|
||||
endfor %}
|
||||
|
||||
Dock_Probe
|
||||
|
|
@ -1,758 +0,0 @@
|
|||
# This macro was provided by discord user Garrettwp to whom i give my thanks for sharing it with me.
|
||||
# I have tweaked it a lot.
|
||||
#
|
||||
# this macro is based on the great Annex magprobe dockable probe macros "#Originally developed by Mental, modified for better use on K-series printers by RyanG and Trails"
|
||||
# that macro can be found here https://github.com/Annex-Engineering/Annex-Engineering_Other_Printer_Mods/blob/master/All_Printers/Microswitch_Probe/Klipper_Macros/dockable_probe_macros.cfg
|
||||
#
|
||||
# by standing on the shoulders of giants, lets see if we can see further
|
||||
# Klicky-probe.cfg version 16-11-2021 01
|
||||
|
||||
[gcode_macro _User_Variables]
|
||||
variable_verbose: True # Enable verbose output
|
||||
variable_travel_speed: 200 # how fast all other travel moves will be performed when running these macros
|
||||
variable_dock_speed: 50 # how fast should the toolhead move when docking the probe for the final movement
|
||||
variable_release_speed: 75 # how fast should the toolhead move to release the hold of the magnets after docking
|
||||
variable_z_drop_speed: 20 # how fast the z will lower when moving to the z location to clear the probe
|
||||
variable_home_z_height: 10 # Z when homing
|
||||
|
||||
#bed type
|
||||
variable_gravity: 'gantry' # What goes down with gravity, bed or gantry?
|
||||
variable_max_bed_y: 250 # maximum Bed size avoids doing a probe_accuracy outside the bed
|
||||
|
||||
# if a separate Z endstop switch is in
|
||||
# use, specify the coordinates of the switch here (Voron).
|
||||
# Set to 0 to have the probe move to center of bed
|
||||
variable_z_endstop_x: 1000
|
||||
variable_z_endstop_y: 1000
|
||||
|
||||
#dock location
|
||||
variable_docklocation_x: 1000 # X Dock position
|
||||
variable_docklocation_y: 1000 # Y Dock position
|
||||
variable_docklocation_z: -128 # Z dock position (-128 for a gantry mount)
|
||||
variable_dockarmslenght: 30 # Dock arms lenght, toolhead movement necessary to clear the dock arms
|
||||
|
||||
#Umbilical to help untangle the umbilical in difficult situations
|
||||
variable_umbilical: False # should we untabgle the umbilical
|
||||
variable_umbilical_x: 15 # X umbilical position
|
||||
variable_umbilical_y: 15 # Y umbilical position
|
||||
|
||||
# location to park the toolhead
|
||||
variable_park_toolhead: False # Enable toolhead parking
|
||||
variable_parkposition_x: 125
|
||||
variable_parkposition_y: 125
|
||||
variable_parkposition_z: 30
|
||||
|
||||
# Do not modify below
|
||||
gcode:
|
||||
{% set Mx = printer['configfile'].config["stepper_x"]["position_max"]|float %}
|
||||
{% set My = printer['configfile'].config["stepper_y"]["position_max"]|float %}
|
||||
{% set Ox = printer['configfile'].config["probe"]["x_offset"]|float %}
|
||||
{% set Oy = printer['configfile'].config["probe"]["y_offset"]|float %}
|
||||
{% set Oz = printer['configfile'].config["probe"]["z_offset"]|float %}
|
||||
|
||||
# if docklocation_z is zero, use Home Z height for safety
|
||||
{% if docklocation_z == 0 %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=docklocation_z VALUE={ home_z_height }
|
||||
{% endif %}
|
||||
|
||||
# If x, y coordinates are set for z endstop, assign them
|
||||
{% if z_endstop_x != 0 or z_endstop_y != 0 %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_x VALUE={ z_endstop_x }
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_y VALUE={ z_endstop_y }
|
||||
|
||||
# if no x, y coordinates for z endstop, assume probe is endstop and move toolhead to center of bed
|
||||
{% else %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_x VALUE={ (Mx * 0.5) - Ox }
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_y VALUE={ (My * 0.5) - Oy }
|
||||
{% endif %}
|
||||
# This macro was provided by discord user Garrettwp to whom i give my thanks for sharing it with me.
|
||||
# I have tweaked it a lot.
|
||||
#
|
||||
# this macro is based on the great Annex magprobe dockable probe macros "#Originally developed by Mental, modified for better use on K-series printers by RyanG and Trails"
|
||||
# that macro can be found here https://github.com/Annex-Engineering/Annex-Engineering_Other_Printer_Mods/blob/master/All_Printers/Microswitch_Probe/Klipper_Macros/dockable_probe_macros.cfg
|
||||
#
|
||||
# by standing on the shoulders of giants, lets see if we can see further
|
||||
|
||||
[gcode_macro _Probe_Variables]
|
||||
variable_probe_attached: False
|
||||
variable_probe_state: False
|
||||
variable_probe_lock: False
|
||||
variable_z_endstop_x: 0
|
||||
variable_z_endstop_y: 0
|
||||
gcode:
|
||||
|
||||
|
||||
[gcode_macro _exit_point]
|
||||
gcode:
|
||||
{% set function = 'pre_' ~ params.FUNCTION %}
|
||||
{% set move = params.MOVE|default(0) %}
|
||||
# mandatory to save the new safe position
|
||||
M400
|
||||
RESTORE_GCODE_STATE NAME={function} MOVE={move}
|
||||
|
||||
|
||||
[gcode_macro _entry_point]
|
||||
gcode:
|
||||
{% set function = 'pre_' ~ params.FUNCTION %}
|
||||
# mandatory to save the new safe position
|
||||
M400
|
||||
SAVE_GCODE_STATE NAME={function}
|
||||
# removes the Z offset for better bed based docking
|
||||
SET_GCODE_OFFSET Z=0
|
||||
# all the macros initially assume absolute positioning
|
||||
G90
|
||||
|
||||
[gcode_macro _Homing_Variables]
|
||||
gcode:
|
||||
{% set R = params.RESET|default(0) %}
|
||||
{% if R %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ False }
|
||||
{% endif %}
|
||||
|
||||
# Attach probe and lock it
|
||||
[gcode_macro Attach_Probe_Lock]
|
||||
description: Attaches Klicky Probe, can only be docked after unlocking
|
||||
gcode:
|
||||
Attach_Probe
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ True }
|
||||
|
||||
# Dock probe and lock it
|
||||
[gcode_macro Dock_Probe_Unlock]
|
||||
description: Docks Klicky Probe even if it was locked
|
||||
gcode:
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ False }
|
||||
Dock_Probe
|
||||
|
||||
# Unlock Probe
|
||||
[gcode_macro Probe_Unlock]
|
||||
description: Unlocks Klicky Probe state
|
||||
gcode:
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ False }
|
||||
|
||||
# Lock Probe
|
||||
[gcode_macro Probe_Lock]
|
||||
description: Locks Klicky Probe state
|
||||
gcode:
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ True }
|
||||
|
||||
# Attach Probe Routine
|
||||
[gcode_macro Attach_Probe]
|
||||
description: Attaches Klicky Probe
|
||||
gcode:
|
||||
# Get probe attach status
|
||||
{% set P = printer["gcode_macro _Probe_Variables"].probe_attached %}
|
||||
{% set L = printer["gcode_macro _Probe_Variables"].probe_lock %}
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
# Get Docking location
|
||||
{% set Mx = printer["gcode_macro _User_Variables"].dockmove_x|default(0) %}
|
||||
{% set My = printer["gcode_macro _User_Variables"].dockmove_y|default(0) %}
|
||||
{% set Mz = printer["gcode_macro _User_Variables"].dockmove_z|default(0) %}
|
||||
{% set Dx = printer["gcode_macro _User_Variables"].docklocation_x %}
|
||||
{% set Dy = printer["gcode_macro _User_Variables"].docklocation_y %}
|
||||
{% set Dz = printer["gcode_macro _User_Variables"].docklocation_z %}
|
||||
{% set Ax = printer["gcode_macro _User_Variables"].attachmove_x|default(0) %}
|
||||
{% set Ay = printer["gcode_macro _User_Variables"].attachmove_y|default(0) %}
|
||||
{% set Az = printer["gcode_macro _User_Variables"].attachmove_z|default(0) %}
|
||||
{% set Gm = printer["gcode_macro _User_Variables"].gravity %}
|
||||
{% set Da = printer["gcode_macro _User_Variables"].dockarmslenght|default(0) %}
|
||||
# Safe Z for travel
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
#Set speed
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
|
||||
{% set Sd = printer["gcode_macro _User_Variables"].dock_speed * 60 %}
|
||||
{% set Sr = printer["gcode_macro _User_Variables"].release_speed * 60 %}
|
||||
{% set Sz = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
|
||||
|
||||
_entry_point function=Attach_Probe
|
||||
|
||||
#if there is no undock movement, assume older behavior
|
||||
{% if Mx == My == Mz == 0 %}
|
||||
{% set Mx = 40 %}
|
||||
{% endif %}
|
||||
#if there is no Attach movement, assume older behavior
|
||||
{% if Ax == Ay == Az == 0 %}
|
||||
{% set Ay = Da %}
|
||||
{% endif %}
|
||||
|
||||
# if x and y are not homed
|
||||
{% if not 'xy' in printer.toolhead.homed_axes %}
|
||||
{ action_raise_error("Must Home X and Y Axis First!") }
|
||||
|
||||
# If probe not attached and locked
|
||||
{% elif not P and not L %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Attaching Probe") }
|
||||
{% endif %}
|
||||
|
||||
{% if (not 'z' in printer.toolhead.homed_axes) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Resetting Z position to zero") }
|
||||
{% endif %}
|
||||
SET_KINEMATIC_POSITION Z=0
|
||||
{% if ('bed' in Gm) %} # checks if the bed or gantry move with gravity
|
||||
{% set Hzh = 0 %}
|
||||
{% elif ('gantry' in Gm) %} # checks if the bed or gantry move with gravity
|
||||
{% set Hzh = Hzh %}
|
||||
{% else %}
|
||||
{ action_raise_error("To avoid head crashes, configure Klicky probe gravity variable!") }
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
#prior to saving actual position, check if its necessary to move to a safe Z
|
||||
#that has enought overhead for the attached probe
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("moving to a safe Z distance") }
|
||||
{% endif %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
{% if (not 'z' in printer.toolhead.homed_axes) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Resetting Z position to zero") }
|
||||
{% endif %}
|
||||
SET_KINEMATIC_POSITION Z=0
|
||||
{% endif %}
|
||||
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
_Umbilical_Path
|
||||
|
||||
# Probe entry location
|
||||
G0 X{Dx|int - Ax|int} Y{Dy|int - Ay|int} F{St}
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz|int - Az|int} F{Sd}
|
||||
{% endif %}
|
||||
|
||||
# Drop Probe to Probe location
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz} F{Sd}
|
||||
{% endif %}
|
||||
G0 X{Dx} Y{Dy} F{Sd}
|
||||
|
||||
# Probe Attach
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz|int - Az|int} F{Sz}
|
||||
{% endif %}
|
||||
G0 X{Dx|int - Ax|int} Y{Dy|int - Ay|int} F{Sr}
|
||||
|
||||
#Go to Z safe distance
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
_Park_Toolhead
|
||||
|
||||
_CheckProbe action=attach
|
||||
|
||||
{% elif L %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Probe locked!") }
|
||||
{% endif %}
|
||||
|
||||
# Probe attached, do nothing
|
||||
_CheckProbe action=query
|
||||
|
||||
{% else %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Probe already attached!") }
|
||||
{% endif %}
|
||||
|
||||
# Probe attached, do nothing
|
||||
_CheckProbe action=query
|
||||
|
||||
{% endif %}
|
||||
_exit_point function=Attach_Probe
|
||||
|
||||
# Dock Probe Routine
|
||||
[gcode_macro Dock_Probe]
|
||||
description: Docks Klicky Probe
|
||||
gcode:
|
||||
# Get probe attach status
|
||||
{% set P = printer["gcode_macro _Probe_Variables"].probe_attached %}
|
||||
{% set L = printer["gcode_macro _Probe_Variables"].probe_lock %}
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
# Get Docking location
|
||||
{% set Mx = printer["gcode_macro _User_Variables"].dockmove_x|default(0) %}
|
||||
{% set My = printer["gcode_macro _User_Variables"].dockmove_y|default(0) %}
|
||||
{% set Mz = printer["gcode_macro _User_Variables"].dockmove_z|default(0) %}
|
||||
{% set Dx = printer["gcode_macro _User_Variables"].docklocation_x %}
|
||||
{% set Dy = printer["gcode_macro _User_Variables"].docklocation_y %}
|
||||
{% set Dz = printer["gcode_macro _User_Variables"].docklocation_z %}
|
||||
{% set Ax = printer["gcode_macro _User_Variables"].attachmove_x|default(0) %}
|
||||
{% set Ay = printer["gcode_macro _User_Variables"].attachmove_y|default(0) %}
|
||||
{% set Az = printer["gcode_macro _User_Variables"].attachmove_z|default(0) %}
|
||||
{% set Da = printer["gcode_macro _User_Variables"].dockarmslenght|default(0) %}
|
||||
# Safe Z for travel
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
# Set speed
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
|
||||
{% set Sd = printer["gcode_macro _User_Variables"].dock_speed * 60 %}
|
||||
{% set Sr = printer["gcode_macro _User_Variables"].release_speed * 60 %}
|
||||
{% set Sz = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
|
||||
|
||||
#if there is no undock movement, assume older behavior
|
||||
{% if Mx == My == Mz == 0 %}
|
||||
{% set Mx = 40 %}
|
||||
{% endif %}
|
||||
#if there is no Attach movement, assume older behavior
|
||||
{% if Ax == Ay == Az == 0 %}
|
||||
{% set Ay = Da %}
|
||||
{% endif %}
|
||||
|
||||
_entry_point function=Dock_Probe
|
||||
|
||||
{% if not 'xyz' in printer.toolhead.homed_axes %}
|
||||
{ action_raise_error("Must Home X, Y and Z Axis First!") }
|
||||
|
||||
# If probe not attached and not locked
|
||||
{% elif P and not L %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Docking Probe") }
|
||||
{% endif %}
|
||||
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
_Umbilical_Path
|
||||
|
||||
# Probe entry location
|
||||
G0 X{Dx|int - Ax|int} Y{Dy|int - Ay|int} F{St}
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz|int - Az|int} F{Sd}
|
||||
{% endif %}
|
||||
# Drop Probe to Probe location
|
||||
G0 X{Dx} Y{Dy} F{Sd}
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz} F{Sd}
|
||||
{% endif %}
|
||||
# Probe decoupling
|
||||
{% if Dz != -128 %}
|
||||
G0 Z{Dz|int + Mz|int} F{Sr}
|
||||
{% endif %}
|
||||
G0 X{Dx|int + Mx|int} Y{Dy|int + My|int} F{Sr}
|
||||
#Go to Z safe distance
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
_Park_Toolhead
|
||||
|
||||
G4 P1000
|
||||
_CheckProbe action=dock
|
||||
|
||||
{% elif L %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Probe locked!") }
|
||||
{% endif %}
|
||||
|
||||
# Probe docked, do nothing
|
||||
_CheckProbe action=query
|
||||
|
||||
{% else %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Probe already docked!") }
|
||||
{% endif %}
|
||||
|
||||
# Probe docked, do nothing
|
||||
_CheckProbe action=query
|
||||
|
||||
{% endif %}
|
||||
_exit_point function=Dock_Probe
|
||||
|
||||
# Probe Calibrate
|
||||
[gcode_macro PROBE_CALIBRATE]
|
||||
rename_existing: _PROBE_CALIBRATE
|
||||
description:Calibrate the probe's z_offset with klicky automount
|
||||
gcode:
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
{% set Sz = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed %}
|
||||
{% set Mx = printer['configfile'].config["stepper_x"]["position_max"]|float %}
|
||||
{% set My = printer['configfile'].config["stepper_y"]["position_max"]|float %}
|
||||
{% set Ox = printer['configfile'].config["probe"]["x_offset"]|float %}
|
||||
{% set Oy = printer['configfile'].config["probe"]["y_offset"]|float %}
|
||||
|
||||
{% if not 'xyz' in printer.toolhead.homed_axes %}
|
||||
{ action_raise_error("Must Home X, Y and Z Axis First!") }
|
||||
{% endif %}
|
||||
|
||||
_entry_point function=PROBE_CALIBRATE
|
||||
|
||||
# Go to Z safe distance before saving location in order to
|
||||
# avoid crashing the probe on the bed when coming back
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
#Protect against PROBE CALIBRATE performed from outside the bed
|
||||
{% if (printer['gcode_move'].position.y > (My - Oy)) or (printer['gcode_move'].position.x > (Mx - Ox)) or (printer['gcode_move'].position.x < Ox) %}
|
||||
{ action_raise_error("Must perform PROBE_CALIBRATE with the probe above the BED!!!") }
|
||||
{% endif%}
|
||||
M400 # mandatory to save the new safe position
|
||||
SAVE_GCODE_STATE NAME=_original_nozzle_location
|
||||
|
||||
_CheckProbe action=query
|
||||
Attach_Probe
|
||||
|
||||
# Restore nozzle location to probe the right place
|
||||
RESTORE_GCODE_STATE NAME=_original_nozzle_location MOVE=1 MOVE_SPEED={St}
|
||||
|
||||
_PROBE_CALIBRATE {% for p in params
|
||||
%}{'%s=%s ' % (p, params[p])}{%
|
||||
endfor %}
|
||||
|
||||
#store current nozzle location
|
||||
SAVE_GCODE_STATE NAME=_original_nozzle_location
|
||||
Dock_Probe
|
||||
|
||||
# Restore nozzle location again at the end
|
||||
RESTORE_GCODE_STATE NAME=_original_nozzle_location MOVE=1 MOVE_SPEED={St}
|
||||
_exit_point function=PROBE_CALIBRATE
|
||||
|
||||
# Probe Accuracy
|
||||
[gcode_macro PROBE_ACCURACY]
|
||||
rename_existing: _PROBE_ACCURACY
|
||||
description:Probe Z-height accuracy at current XY position with klicky automount
|
||||
gcode:
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
{% set Sz = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed %}
|
||||
{% set By = printer["gcode_macro _User_Variables"].max_bed_y %}
|
||||
{% set Oy = printer['configfile'].config["probe"]["y_offset"]|float %}
|
||||
|
||||
{% if not 'xyz' in printer.toolhead.homed_axes %}
|
||||
{ action_raise_error("Must Home X, Y and Z Axis First!") }
|
||||
{% endif %}
|
||||
|
||||
_entry_point function=PROBE_ACCURACY
|
||||
|
||||
# Go to Z safe distance before saving location in order to
|
||||
# avoid crashing the probe on the bed when coming back
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
G0 Z{Hzh} F{Sz}
|
||||
{% endif %}
|
||||
|
||||
#Protect against PROBE ACCURACY performed from outside the bed
|
||||
{% if (printer.toolhead.position.y > (By - Oy)) %}
|
||||
{ action_raise_error("Must perform PROBE_ACCURACY with the probe above the BED!!!") }
|
||||
{% endif%}
|
||||
M400 # mandatory to save the new safe position
|
||||
SAVE_GCODE_STATE NAME=_original_nozzle_location
|
||||
|
||||
_CheckProbe action=query
|
||||
Attach_Probe
|
||||
|
||||
# Restore nozzle location to probe the right place
|
||||
RESTORE_GCODE_STATE NAME=_original_nozzle_location MOVE=1 MOVE_SPEED={St}
|
||||
|
||||
_PROBE_ACCURACY {% for p in params
|
||||
%}{'%s=%s ' % (p, params[p])}{%
|
||||
endfor %}
|
||||
|
||||
#store current nozzle location
|
||||
SAVE_GCODE_STATE NAME=_original_nozzle_location
|
||||
|
||||
Dock_Probe
|
||||
|
||||
# Restore nozzle location again at the end
|
||||
RESTORE_GCODE_STATE NAME=_original_nozzle_location MOVE=1 MOVE_SPEED={St}
|
||||
_exit_point function=PROBE_ACCURACY
|
||||
|
||||
# enable to SET_KINEMATIC_POSITION for Z hop
|
||||
[force_move]
|
||||
enable_force_move: True
|
||||
|
||||
# Homeing Override
|
||||
[homing_override]
|
||||
axes: xyz
|
||||
gcode:
|
||||
# collect user state variables
|
||||
_User_Variables
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
{% set Gm = printer["gcode_macro _User_Variables"].gravity %}
|
||||
{% set Ax = printer["gcode_macro _User_Variables"].attachmove_x|default(0) %}
|
||||
{% set Ay = printer["gcode_macro _User_Variables"].attachmove_y|default(0) %}
|
||||
{% set Az = printer["gcode_macro _User_Variables"].attachmove_z|default(0) %}
|
||||
{% set Da = printer["gcode_macro _User_Variables"].dockarmslenght|default(0) %}
|
||||
|
||||
#if there is no Attach movement, assume older behavior
|
||||
{% if Ax == Ay == Az == 0 %}
|
||||
{% set Ay = Da %}
|
||||
{% endif %}
|
||||
|
||||
_CheckProbe action=query
|
||||
|
||||
# reset parameters
|
||||
{% set X, Y, Z = False, False, False %}
|
||||
|
||||
# which axes have been requested for homing
|
||||
{% if not 'X' in params
|
||||
and not 'Y' in params
|
||||
and not 'Z' in params %}
|
||||
|
||||
{% set X, Y, Z = True, True, True %}
|
||||
|
||||
{% else %}
|
||||
{% if 'X' in params %}
|
||||
{% set X = True %}
|
||||
{% endif %}
|
||||
|
||||
{% if 'Y' in params %}
|
||||
{% set Y = True %}
|
||||
{% endif %}
|
||||
|
||||
{% if 'Z' in params %}
|
||||
{% set Z = True %}
|
||||
{% endif %}
|
||||
|
||||
{% if 'X' in params
|
||||
and 'Y' in params
|
||||
and 'Z' in params %}
|
||||
# reset homing state variables
|
||||
# if homing all axes
|
||||
_Homing_Variables reset=1
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
_entry_point function=homing_override
|
||||
|
||||
# if Z is not homed, do not move the bed if it goes down
|
||||
{% if ('z' not in printer.toolhead.homed_axes) %}
|
||||
{% if ('bed' in Gm) %} # checks if the bed or gantry move with gravity
|
||||
{% set Hzh = 0 %}
|
||||
{% elif ('gantry' in Gm) %} # checks if the bed or gantry move with gravity
|
||||
{% set Hzh = Hzh %}
|
||||
{% else %}
|
||||
{ action_raise_error("To avoid head crashes, configure Klicky probe gravity variable!") }
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if Z %}
|
||||
{% if ('z' in printer.toolhead.homed_axes) %}
|
||||
{% if (printer.toolhead.position.z < Hzh) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Z too low, performing ZHOP") }
|
||||
{% endif %}
|
||||
G0 Z{Hzh} F1200
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Z not homed, forcing full G28") }
|
||||
{% endif %}
|
||||
SET_KINEMATIC_POSITION X=0 Y=0 Z=0
|
||||
G0 Z{Hzh} F600
|
||||
{% set X, Y, Z = True, True, True %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
# if the dock is oriented on the Y, first do Y endstop
|
||||
{% if Ay == 0 %}
|
||||
# Home y
|
||||
{% if Y %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Homing Y") }
|
||||
{% endif %}
|
||||
G28 Y0
|
||||
{% endif %}
|
||||
{% set Y = 0 %}
|
||||
{% endif %}
|
||||
|
||||
# Home x
|
||||
{% if X %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Homing X") }
|
||||
{% endif %}
|
||||
G28 X0
|
||||
{% endif %}
|
||||
|
||||
# Home y
|
||||
{% if Y %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Homing Y") }
|
||||
{% endif %}
|
||||
G28 Y0
|
||||
{% endif %}
|
||||
|
||||
# Home z
|
||||
{% if Z %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Homing Z") }
|
||||
{% endif %}
|
||||
|
||||
# if probe is configured as endstop, attach it, else dock the probe if attached
|
||||
{% if printer['configfile'].config["stepper_z"]["endstop_pin"] == 'probe:z_virtual_endstop' %}
|
||||
Attach_Probe
|
||||
{% else %}
|
||||
Dock_Probe
|
||||
{% endif %}
|
||||
|
||||
_Home_Z
|
||||
|
||||
# if probe is configured as endstop, dock it
|
||||
{% if printer['configfile'].config["stepper_z"]["endstop_pin"] == 'probe:z_virtual_endstop' %}
|
||||
Dock_Probe
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
_CheckProbe action=query
|
||||
|
||||
# park the toolhead
|
||||
_Park_Toolhead
|
||||
_exit_point function=homing_override
|
||||
|
||||
# umbilical path setup
|
||||
[gcode_macro _Umbilical_Path]
|
||||
gcode:
|
||||
{% set Ux = printer["gcode_macro _User_Variables"].umbilical_x %}
|
||||
{% set Uy = printer["gcode_macro _User_Variables"].umbilical_y %}
|
||||
{% set U = printer["gcode_macro _User_Variables"].umbilical %}
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
|
||||
|
||||
{% if U %}
|
||||
# Used to give the umbilical a better path to follow and coil properly if dock is tight in space
|
||||
_entry_point function=Umbilical_Path
|
||||
G0 X{Ux} Y{Uy} Z{Hzh} F{St}
|
||||
_exit_point function=Umbilical_Path
|
||||
{% endif %}
|
||||
|
||||
|
||||
# Home Z Routine
|
||||
[gcode_macro _Home_Z]
|
||||
gcode:
|
||||
{% set Zx = printer["gcode_macro _Probe_Variables"].z_endstop_x %}
|
||||
{% set Zy = printer["gcode_macro _Probe_Variables"].z_endstop_y %}
|
||||
{% set Hzh = printer["gcode_macro _User_Variables"].home_z_height|float %}
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
|
||||
{% set Sz = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %}
|
||||
|
||||
_entry_point function=Home_Z
|
||||
|
||||
# if x and y are not homed yet, raise error
|
||||
{% if not 'xy' in printer.toolhead.homed_axes %}
|
||||
{ action_raise_error("Must Home X and Y Axis First!") }
|
||||
|
||||
{% else %}
|
||||
{% if (not 'z' in printer.toolhead.homed_axes) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Resetting Z position to zero") }
|
||||
{% endif %}
|
||||
SET_KINEMATIC_POSITION Z=0
|
||||
{% endif %}
|
||||
|
||||
# move tool to safe homing position and home Z axis
|
||||
# location of z endstop
|
||||
G0 X{Zx} Y{Zy} F{St}
|
||||
G28 Z0
|
||||
G0 Z{Hzh} F{Sz}
|
||||
|
||||
{% endif %}
|
||||
_exit_point function=Home_Z
|
||||
|
||||
|
||||
# check to see if probe is where it is supposed to be after
|
||||
# attaching/docking maneuver and set homing error or shutdown
|
||||
[gcode_macro _CheckProbe]
|
||||
variable_probe_state: 0
|
||||
gcode:
|
||||
Query_Probe
|
||||
_SetProbeState action={ ACTION }
|
||||
|
||||
|
||||
# due to how templates are evaluated, we have query endstops in one
|
||||
# macro and call another macro to make decisions based on the result
|
||||
[gcode_macro _SetProbeState]
|
||||
gcode:
|
||||
{% set P = printer.probe.last_query %}
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
|
||||
# If triggered (true), probe not attached
|
||||
{% if P %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_attached VALUE={ False }
|
||||
|
||||
# If not triggered (false), probe attached
|
||||
{% else %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_attached VALUE={ True }
|
||||
{% endif %}
|
||||
|
||||
{% if params.ACTION == 'query' %}
|
||||
SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_state VALUE={ P }
|
||||
{% endif %}
|
||||
|
||||
# if probe fails to attach/detach
|
||||
# if not docked
|
||||
{% if (not P and params.ACTION == 'dock') %}
|
||||
{ action_raise_error("Probe dock failed!") }
|
||||
{% endif %}
|
||||
|
||||
# if not attached
|
||||
{% if P and params.ACTION == 'attach' %}
|
||||
{ action_raise_error("Probe attach failed!") }
|
||||
{% endif %}
|
||||
|
||||
# Park Toolhead Routine
|
||||
[gcode_macro _Park_Toolhead]
|
||||
gcode:
|
||||
{% set P = printer["gcode_macro _User_Variables"].park_toolhead %}
|
||||
{% set Px = printer["gcode_macro _User_Variables"].parkposition_x %}
|
||||
{% set Py = printer["gcode_macro _User_Variables"].parkposition_y %}
|
||||
{% set Pz = printer["gcode_macro _User_Variables"].parkposition_z %}
|
||||
{% set St = printer["gcode_macro _User_Variables"].travel_speed * 60 %}
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
|
||||
_entry_point function=Park_Toolhead
|
||||
|
||||
{% if (P and 'xyz' in printer.toolhead.homed_axes) %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Parking Toolhead") }
|
||||
{% endif %}
|
||||
G0 X{Px} Y{Py} Z{Pz} F{St}
|
||||
{% endif %}
|
||||
_exit_point function=Park_Toolhead
|
||||
|
||||
# Quad Gantry Level
|
||||
[gcode_macro QUAD_GANTRY_LEVEL]
|
||||
rename_existing: _QUAD_GANTRY_LEVEL
|
||||
description: Conform a moving, twistable gantry to the shape of a stationary bed with klicky automount
|
||||
gcode:
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
{% if V %}
|
||||
{ action_respond_info("QG Level") }
|
||||
{% endif %}
|
||||
|
||||
_CheckProbe action=query
|
||||
Attach_Probe
|
||||
|
||||
_QUAD_GANTRY_LEVEL {% for p in params
|
||||
%}{'%s=%s ' % (p, params[p])}{%
|
||||
endfor %}
|
||||
Dock_Probe
|
||||
|
||||
# Bed Mesh Calibrate
|
||||
[bed_mesh]
|
||||
|
||||
[gcode_macro BED_MESH_CALIBRATE]
|
||||
rename_existing: _BED_MESH_CALIBRATE
|
||||
description: Perform Mesh Bed Leveling with klicky automount
|
||||
gcode:
|
||||
|
||||
{% set V = printer["gcode_macro _User_Variables"].verbose %}
|
||||
{% if V %}
|
||||
{ action_respond_info("Bed Mesh Calibrate") }
|
||||
{% endif %}
|
||||
|
||||
_CheckProbe action=query
|
||||
Attach_Probe
|
||||
|
||||
_BED_MESH_CALIBRATE {% for p in params
|
||||
%}{'%s=%s ' % (p, params[p])}{%
|
||||
endfor %}
|
||||
|
||||
Dock_Probe
|
||||
|
||||
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
[z_calibration]
|
||||
|
||||
## update these variable according to the documentation here https://github.com/protoloft/klipper_z_calibration
|
||||
## you then should call CALIBRATE_Z as one of the last lines on your PRINT_START to set the Z offset dinamically
|
||||
#probe_nozzle_x: YOUR Z Endstop X
|
||||
#probe_nozzle_y: YOUR Z Endstop X
|
||||
# The X and Y coordinates (in mm) for clicking the nozzle on the
|
||||
# Z endstop.
|
||||
#(probe_switch_x should be minus 5mm from the probe_nozzle_x)
|
||||
#probe_switch_x:
|
||||
#(probe_switch_y should be minus 10.5mm from the probe_nozzle_y)
|
||||
#probe_switch_y:
|
||||
# The X and Y coordinates (in mm) for clicking the probe's switch
|
||||
# on the Z endstop.
|
||||
#probe_bed_x: default from relative_reference_index of bed_mesh
|
||||
#probe_bed_y: default from relative_reference_index of bed_mesh
|
||||
# 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.
|
||||
switch_offset: 0.42
|
||||
# The trigger point offset of the used klicky switch.
|
||||
# This needs to be fined out manually. More on this later
|
||||
# in this section..
|
||||
max_deviation: 1.5
|
||||
# The maximum allowed deviation of the calculated offset.
|
||||
# If the offset exceeds this value, it will stop!
|
||||
# The default is 1.0 mm.
|
||||
#samples: default from [probe] section
|
||||
# The number of times to probe each point. The probed z-values
|
||||
# will be averaged. The default is from the probe's configuration.
|
||||
#samples_tolerance: default from [probe] 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_retries: default from [probe] 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_result: default from [probe] section
|
||||
# The calculation method when sampling more than once - either
|
||||
# "median" or "average". The default is from the probe's configuration.
|
||||
clearance: 10
|
||||
# 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.
|
||||
position_min: 0
|
||||
# Minimum valid distance (in mm) used for probing move. The
|
||||
# default is from the Z rail configuration.
|
||||
speed: 100
|
||||
# The moving speed in X and Y. The default is 50 mm/s.
|
||||
#lift_speed: 100
|
||||
# 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.
|
||||
#probing_speed: default homing_speed from [stepper_z] section.
|
||||
# The fast probing speed (in mm/s) used, when probing_first_fast
|
||||
# is activated. The default is from the Z rail configuration.
|
||||
#probing_second_speed: default second_homing_speed from [stepper_z] section.
|
||||
# The slower speed (in mm/s) for probing the recorded samples.
|
||||
# The default is second_homing_speed of the Z rail configuration.
|
||||
#probing_retract_dist: default homing_retract_dist from [stepper_z] section.
|
||||
# Distance to backoff (in mm) before probing the next sample.
|
||||
# The default is homing_retract_dist from the Z rail configuration.
|
||||
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: Dock_Probe_Unlock
|
||||
# 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: Dock_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.
|
||||
|
||||
[gcode_macro CALIBRATE_Z]
|
||||
rename_existing: BASE_CALIBRATE_Z
|
||||
gcode:
|
||||
M117 Z-Calibration..
|
||||
BASE_CALIBRATE_Z
|
||||
M117
|
||||
|
|
@ -24,7 +24,9 @@ Mental created the initial macro and one of the first magnetically attached micr
|
|||
|
||||
Without them, and some others this effort would not be in the current state, many thanks to them all.
|
||||
|
||||
If you want to donate something regarding this project, use this [link](https://paypal.me/Josar154), thanks
|
||||
If you want to donate something regarding this project, use this [link](https://paypal.me/Josar154) or [__Buy me some ABS!__](https://www.buymeacoffee.com/JosAr), thanks
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
|
@ -276,7 +278,7 @@ Normally the endstop pin have a hardware solution.
|
|||
|
||||
|
||||
## Step 6: klipper configuration Dock/Undock Macro
|
||||
You will need to add macros to klipper to be able to dock and undock the probe as necessary to do the Endstop (if necessary) and Quad Gantry Level, it is in the klipper Macro directory.
|
||||
You will need to add macros to klipper to be able to dock and undock the probe as necessary to do the Endstop (if necessary) and Quad Gantry Level, to ease updates on this repository, they are on the main [Klicky repository](https://github.com/jlas1/Klicky-Probe)
|
||||
|
||||
The macro is based on a version provided by the user garrettwp on Discord, many thanks to him.
|
||||
I have tweaked it a lot.
|
||||
|
|
@ -362,7 +364,7 @@ position_max: 305
|
|||
If you want to use the Z endstop switch of the Voron to calculate the Z-Offset, use the new [automatic Z calibration](https://github.com/protoloft/klipper_z_calibration).
|
||||
|
||||
Most of necessary macros are already included in the klicky-probe.cfg, what is missing is the specific z_calibration configuration and the macro that is called to do the actual calibration.
|
||||
All of this is included in the [Klicky automatic Z calibration configuration](./Klipper_macro/z_calibration.cfg)
|
||||
All of this is included in the Klicky automatic Z calibration configuration, that can be found on the main [Klicky repository](https://github.com/jlas1/Klicky-Probe)
|
||||
|
||||
You should then add a call to CALIBRATE_Z at the end of your PRINTER_START (before any purge line).
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue