267 lines
7 KiB
INI
267 lines
7 KiB
INI
####################################################################
|
|
# Macros used for printing
|
|
# - BRUSHIE
|
|
# - CANCEL_PRINT
|
|
# - LOAD_FILAMENT
|
|
# - UNLOAD_FILAMENT
|
|
# - M600
|
|
# - M601
|
|
# - M900
|
|
# - PARK
|
|
# - PAUSE
|
|
# - PRINT_START
|
|
# - PRINT_END
|
|
# - PRINT_LAYER_CHANGE
|
|
# - PURGE_NOZZLE
|
|
# - RESUME
|
|
####################################################################
|
|
|
|
|
|
# BRUSHIE
|
|
[gcode_macro BRUSHIE]
|
|
gcode:
|
|
{% set x0=250 %}
|
|
{% set x1=200 %}
|
|
{% set y0=printer.toolhead.axis_maximum.y %}
|
|
{% set z0=2.5 %}
|
|
# {% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|int %}
|
|
{% set z_hop = 10 %}
|
|
{% if "xyz" in printer.toolhead.homed_axes %}
|
|
G0 Z{z_hop} F1000 # move Z to travel height
|
|
G0 X{x0} Y{y0} F6000 # move to x0/y0
|
|
G0 Z{z0} # lower
|
|
G0 X{x1} # 1
|
|
G0 X{x0} # 2
|
|
G0 X{x1} # 3
|
|
G0 Z{z_hop} F300 # move Z to travel height
|
|
{% else %}
|
|
M118 printer not homed
|
|
{% endif %}
|
|
|
|
|
|
# # - CANCEL_PRINT
|
|
[gcode_macro CANCEL_PRINT]
|
|
description: Cancel the actual running print
|
|
rename_existing: _CANCEL_PRINT_BASE
|
|
gcode:
|
|
SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=0
|
|
CLEAR_PAUSE
|
|
SDCARD_RESET_FILE
|
|
TURN_OFF_HEATERS
|
|
PARK
|
|
_CANCEL_PRINT_BASE
|
|
|
|
|
|
[gcode_macro LOAD_FILAMENT]
|
|
gcode:
|
|
T0
|
|
|
|
|
|
[gcode_macro UNLOAD_FILAMENT]
|
|
gcode:
|
|
ERCF_EJECT
|
|
|
|
|
|
[gcode_macro M600]
|
|
description: Change filament
|
|
gcode:
|
|
SAVE_GCODE_STATE NAME=M600_state
|
|
PAUSE
|
|
M118 M600 change filament
|
|
RESTORE_GCODE_STATE NAME=M600_state
|
|
|
|
[gcode_macro M601]
|
|
description: Pause print
|
|
gcode:
|
|
PAUSE
|
|
|
|
[gcode_macro M900]
|
|
description: Set pressure advance
|
|
gcode:
|
|
SET_PRESSURE_ADVANCE ADVANCE={params.K|default(0)}
|
|
|
|
|
|
# PARK
|
|
[gcode_macro PARK]
|
|
gcode:
|
|
{% set Y=params.Y|default(295) %}
|
|
{% set X=params.X|default(295) %}
|
|
{% set Z=params.Z|default(-1) %}
|
|
{% if "xyz" in printer.toolhead.homed_axes %}
|
|
# calculate save lift position
|
|
{% set z_max = printer.toolhead.axis_maximum.z|float %}
|
|
{% set z_act = printer.toolhead.position.z|float %}
|
|
{% set z_safe = z_act + 5 %}
|
|
{% if z_safe > z_max %}
|
|
{% set z_safe = z_max %}
|
|
{% endif %}
|
|
{% if Z != - 1 %}
|
|
{% set z_safe = Z %}
|
|
{% endif %}
|
|
G91 # use relative coordinates
|
|
G0 Z{z_safe} F1200
|
|
G90 # use absolute coordinates
|
|
G0 X{X} Y{Y} F6000
|
|
{% else %}
|
|
M118 printer not homed
|
|
{% endif %}
|
|
|
|
|
|
# - PAUSE
|
|
[gcode_macro PAUSE]
|
|
rename_existing: _PAUSE_BASE
|
|
gcode:
|
|
{% if printer.pause_resume.is_paused|lower == 'false' %}
|
|
G92 E0
|
|
{% if printer.extruder.can_extrude %}
|
|
G1 E-1.0 F1500.0
|
|
{% endif %}
|
|
G90 # use absolute coordinates
|
|
SAVE_GCODE_STATE NAME=PAUSE_state
|
|
_PAUSE_BASE
|
|
PARK
|
|
{% else %}
|
|
M117 already paused
|
|
M118 already paused
|
|
{% endif %}
|
|
|
|
|
|
# - PRINT_START
|
|
[gcode_macro PRINT_START]
|
|
gcode:
|
|
{% set BED=params.BED|default(100)|int %}
|
|
{% set EXTRUDER=params.EXTRUDER|default(250)|int %}
|
|
{% set QGL=params.QGL|default(1)|int %}
|
|
{% set BMC=params.BMC|default(0)|int %}
|
|
{% set SHEET=params.SHEET|default("default")|string %}
|
|
{% set PURGE=params.PURGE|default(1)|int %}
|
|
{% set Z_ADJUST=params.Z_ADJUST|default(0.0)|float %}
|
|
{% set ERCF=params.ERCF|default(0)|int %}
|
|
{% set ERCF_EXTRUDER=params.ERCF_EXTRUDER|default(0)|int %}
|
|
{action_respond_info("starting print BED=%d, EXTRUDER=%d, SHEET=%s, BMC=%d, PURGE=%d, Z_AJUST=%f, ERCF=%d, ERCF_EXTRUDER=%d" % (BED, EXTRUDER, SHEET, BMC, PURGE, Z_ADJUST, ERCF, ERCF_EXTRUDER))}
|
|
M117 CONFIGURING
|
|
M118 CONFIGURING
|
|
SET_GCODE_OFFSET Z=0.0 # reset z offset
|
|
M140 S{BED} # start bed heating to bed
|
|
# M104 S{EXTRUDER} # start extruder heating
|
|
G92 E0 # reset extruder
|
|
G21 # set units to millimeters
|
|
G90 # use absolute coordinates
|
|
M83 # use relative distances for extrusion
|
|
|
|
BED_MESH_CLEAR
|
|
# HOME
|
|
M117 HOME
|
|
M118 HOME
|
|
G28
|
|
BRUSHIE
|
|
G28 Z
|
|
# QGL
|
|
{% if QGL %}
|
|
M117 QGL
|
|
M118 QGL
|
|
QUAD_GANTRY_LEVEL
|
|
{% else %}
|
|
M117 NO QGL
|
|
M118 NO QGL
|
|
{% endif %}
|
|
# BMC
|
|
{% if BMC %}
|
|
M117 BED MESH CALIBRATE
|
|
M118 BED MESH CALIBRATE
|
|
BED_MESH_CALIBRATE
|
|
{% else %}
|
|
M117 BED MESH LOAD {SHEET}
|
|
M118 BED MESH LOAD {SHEET}
|
|
BED_MESH_PROFILE LOAD={SHEET}
|
|
{% endif %}
|
|
PARK Z=10
|
|
|
|
G92 E0 # reset extruder
|
|
G90 # use absolute coordinates
|
|
NOTIFY_BED BED={BED}
|
|
M190 S{BED} # set and wait for actual bed temperature
|
|
NOTIFY_EXTRUDER EXTRUDER={BED}
|
|
M109 S{EXTRUDER} # set and wait for extruder temperature
|
|
|
|
SET_GCODE_OFFSET Z_ADJUST={params.Z_ADJUST|default(0.0)|float} MOVE=1
|
|
{% if ERCF %}
|
|
M117 ercf changing to tool {ERCF_EXTRUDER}
|
|
M118 ercf changing to tool {ERCF_EXTRUDER}
|
|
ERCF_HOME
|
|
ERCF_CHANGE_TOOL_SLICER TOOL={ERCF_EXTRUDER}
|
|
{% endif %}
|
|
BRUSHIE
|
|
# {% if PURGE %}
|
|
# PURGE_NOZZLE
|
|
# {% endif %}
|
|
M117 STARTING
|
|
M118 STARTING
|
|
|
|
|
|
# - PRINT_END
|
|
[gcode_macro PRINT_END]
|
|
gcode:
|
|
{% set UNLOAD_AT_END=params.UNLOAD_AT_END|default(0)|int %}
|
|
M118 finished
|
|
PARK
|
|
M400 ; wait for buffer to clear
|
|
G92 E0 ; zero the extruder
|
|
G1 E-10.0 F3600 ; retract filament
|
|
{% if UNLOAD_AT_END == 1 %}
|
|
ERCF_EJECT
|
|
{% endif %}
|
|
TURN_OFF_HEATERS
|
|
M107 ; turn off fan
|
|
|
|
|
|
# - PURGE_NOZZLE
|
|
[gcode_macro PURGE_NOZZLE]
|
|
gcode:
|
|
{% set x0=params.x0|default(100) %}
|
|
{% set x1=params.x1|default(200) %}
|
|
{% set y0=params.y0|default(2) %}
|
|
{% set y1=params.y1|default(3) %}
|
|
# {% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|int %}
|
|
{% set z_hop = 10 %}
|
|
M118 purge nozzle
|
|
G0 Z{z_hop} F300 # move Z to travel height
|
|
G0 X{x0} Y{y0} F5000 # move to x0/y0
|
|
G0 Z0.24 F300 # lower Z to 75%
|
|
G0 X{x1} E20 F1500 # draw line
|
|
G0 Y{y1} # move to y1
|
|
G0 X{x0} E10 # draw fine line
|
|
G0 X{x0-10} # move a little further
|
|
# G0 E-5 # retract filament
|
|
G0 Z{z_hop} F300 # move Z to travel height
|
|
|
|
|
|
# - RESUME
|
|
[gcode_macro RESUME]
|
|
description: Resume the actual running print
|
|
rename_existing: _RESUME_BASE
|
|
gcode:
|
|
{% if printer.pause_resume.is_paused|lower == 'true' %}
|
|
{% if printer["gcode_macro _ERCF_PAUSE"].is_paused|int != 0 %}
|
|
M118 You can't resume the print without unlocking the ERCF first.
|
|
M118 Run ERCF_UNLOCK and solve any issue before hitting Resume again
|
|
{% else %}
|
|
RESTORE_GCODE_STATE NAME=PAUSE_state
|
|
G90
|
|
{% if printer["gcode_macro _ERCF_VAR"].clog_detection|int == 1 %}
|
|
SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=1
|
|
{% endif %}
|
|
_RESUME_BASE
|
|
{% endif %}
|
|
{% else %}
|
|
M117 not paused
|
|
M118 not paused
|
|
{% endif %}
|
|
|
|
|
|
[gcode_macro PRINT_LAYER_CHANGE]
|
|
gcode:
|
|
{% set layer=params.LAYER|default(0)|int %}
|
|
{% set layer_z=params.LAYER_Z|default(0) %}
|
|
{% set total_layer_count=params.TOTAL_LAYER_COUNT|default(0) %}
|
|
M117 layer {layer+1}/{total_layer_count} {layer_z}mm
|