147 lines
4.8 KiB
INI
147 lines
4.8 KiB
INI
#####################################################################
|
|
# Customized standard macros
|
|
#####################################################################
|
|
#
|
|
# !!! Caution !!!
|
|
#
|
|
# PROBE_CALIBRATE can not dock the Magprobe automatically, as it
|
|
# start's a scripting process we need to stop at the execution
|
|
# of the base macro. Use
|
|
# - PROBE_ABORT
|
|
# - PROBE_ACCEPT
|
|
# instead of the original ABORT and ACCEPT to also dock the probe
|
|
#
|
|
# - BED_MESH_CALIBRATE
|
|
# - G0
|
|
# - G1
|
|
# - QUAD_GANTRY_LEVEL
|
|
#####################################################################
|
|
|
|
|
|
## BED_MESH_CALIBRATE
|
|
[gcode_macro BED_MESH_CALIBRATE]
|
|
description: Perform QGL and bed mesh leveling
|
|
rename_existing: _BED_MESH_CALIBRATE_BASE
|
|
gcode:
|
|
##### get params and prepare to send them to the base macro #####
|
|
{% set get_params = [] %}
|
|
{% for key in params %}
|
|
{% set get_params = get_params.append(key + "=" + params[key]) %}
|
|
{% endfor %}
|
|
##### end of definitions #####
|
|
_CG28
|
|
BED_MESH_CLEAR
|
|
## check if QGL was already executed
|
|
{% if printer.quad_gantry_level.applied|lower == 'false' %}
|
|
QUAD_GANTRY_LEVEL PARK=false
|
|
{% endif %}
|
|
ATTACH_PROBE
|
|
_BED_MESH_CALIBRATE_BASE {get_params|join(" ")}
|
|
DETACH_PROBE
|
|
|
|
## GO
|
|
# If your probe needs a Z move for attach/detach use either
|
|
# G0 .... FORCE
|
|
[gcode_macro G0]
|
|
description: Move gcode that prevents moves lower than the limit when probe attached
|
|
rename_existing: G0.1
|
|
gcode:
|
|
##### set manual override #####
|
|
{% if 'FORCE' in params|upper %}
|
|
{% set force = 1 %}
|
|
{% else %}
|
|
{% set force = 0 %}
|
|
{% endif %}
|
|
##### get params #####
|
|
{% set get_params = [] %}
|
|
{% for key in params %}
|
|
{% if key is not in ['G', 'FORCE'] %} ;G1/G0 is also seen as parameter
|
|
{% set get_params = get_params.append(key + "=" + params[key]) %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
##### add caller #####
|
|
{% set tmp = get_params.append("CALLER=G0") %} ;hack to append list objects outside of a loop
|
|
##### add force #####
|
|
{% set tmp = get_params.append("FORCE=" + force|string) %} ;hack to append list objects outside of a loop
|
|
##### end of definition #####
|
|
{% if printer['gcode_macro _MAG_PROBE'].state|lower == 'unknown' and force == 0 %}
|
|
_MAG_PROBE ACTION=GET_STATUS RESPOND=0
|
|
{% endif %}
|
|
_Z_MOVE_CHECK {get_params|join(" ")}
|
|
|
|
## TODO
|
|
## G1
|
|
# If your probe needs a Z move for attach/detach use either
|
|
# G1 .... FORCE
|
|
# [gcode_macro G1]
|
|
# description: Move gcode that prevents moves lower than the limit when probe attached
|
|
# rename_existing: G1.1
|
|
# gcode:
|
|
# ##### set manual override #####
|
|
# {% if 'FORCE' in params|upper %}
|
|
# {% set force = 1 %}
|
|
# {% else %}
|
|
# {% set force = 0 %}
|
|
# {% endif %}
|
|
# ##### get params #####
|
|
# {% set get_params = [] %}
|
|
# {% for key in params %}
|
|
# {% if key is not in ['G', 'FORCE'] %} ;G1/G0 is also seen as parameter
|
|
# {% set get_params = get_params.append(key + "=" + params[key]) %}
|
|
# {% endif %}
|
|
# {% endfor %}
|
|
# ##### add caller #####
|
|
# {% set tmp = get_params.append("CALLER=G1") %} ;hack to append list objects outside of a loop
|
|
# ##### add force #####
|
|
# {% set tmp = get_params.append("FORCE=" + force|string) %} ;hack to append list objects outside of a loop
|
|
# ##### end of definition #####
|
|
# {% if printer['gcode_macro _MAG_PROBE'].state|lower == 'unknown' and force == 0 %}
|
|
# _MAG_PROBE ACTION=GET_STATUS RESPOND=0
|
|
# {% endif %}
|
|
# _Z_MOVE_CHECK {get_params|join(" ")}
|
|
|
|
|
|
## QUAD_GANTRY_LEVEL
|
|
[gcode_macro QUAD_GANTRY_LEVEL]
|
|
description: Level a flying gantry to a stationary bed
|
|
rename_existing: _QUAD_GANTRY_LEVEL
|
|
gcode:
|
|
##### get user defines #####
|
|
{% set park_pos = printer['gcode_macro _USER_VARIABLE'].park_bed %}
|
|
{% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|float %}
|
|
##### get toolhead position #####
|
|
{% set act_z = printer.toolhead.position.z|float %}
|
|
##### set default #####
|
|
{% set park = params.PARK|default('true') %}
|
|
##### end of definitions #####
|
|
# home all axes if not already
|
|
{% if "xyz" not in printer.toolhead.homed_axes %}
|
|
_CG28
|
|
{% endif %}
|
|
SAVE_GCODE_STATE NAME=STATE_QUAD_GANTRY_LEVEL
|
|
_SET_ACC VAL=HOME
|
|
_SET_CURRENT VAL=HOME
|
|
_CG28 RESET_SETTINGS=false
|
|
{% if act_z < z_hop %}
|
|
G1 Z{z_hop} F900 ; move head up to insure Probe is not triggered in error case
|
|
{% endif %}
|
|
ATTACH_PROBE
|
|
_QUAD_GANTRY_LEVEL
|
|
{% if params.CALIBRATE|default('false') == 'true' %}
|
|
CALIBRATE_Z RESET_SETTINGS=false
|
|
{% else %}
|
|
DETACH_PROBE
|
|
{% endif %}
|
|
#G28 Z
|
|
{% if params.RESET_SETTINGS|default('true') == 'true' %}
|
|
_SET_CURRENT
|
|
_SET_ACC
|
|
{% endif %}
|
|
{% if park|lower == 'true' %}
|
|
G90
|
|
G0 Z{park_pos[2]} F1800 ; move nozzle to z high first
|
|
G0 X{park_pos[0]} Y{park_pos[1]} F18000 ; home to get toolhead in the middle
|
|
{% endif %}
|
|
RESTORE_GCODE_STATE NAME=STATE_QUAD_GANTRY_LEVEL
|
|
|
|
|