237 lines
6.5 KiB
INI
237 lines
6.5 KiB
INI
####################################################################
|
|
# Macros used for printing
|
|
# - BRUSHIE
|
|
# - CANCEL_PRINT
|
|
# - M600
|
|
# - PARK
|
|
# - PAUSE
|
|
# - PRINT_START
|
|
# - PRINT_END
|
|
# - PURGE_NOZZLE
|
|
# - RESUME
|
|
####################################################################
|
|
|
|
|
|
# BRUSHIE
|
|
[gcode_macro BRUSHIE]
|
|
gcode:
|
|
{% set x0=40 %}
|
|
{% set x1=110 %}
|
|
{% set y0=305 %}
|
|
{% set z0=1 %}
|
|
{% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|int %}
|
|
{% if "xyz" in printer.toolhead.homed_axes %}
|
|
M117 > brushie brushie brushie
|
|
G0 Z{z_hop} F1000 # move Z to travel height
|
|
G0 X{x0} Y{y0} F5000 # move to x0/y0
|
|
G0 Z{z0} # lower
|
|
G0 X{x1} # back
|
|
G0 X{x0} # forth
|
|
G0 X{x1} # back
|
|
G0 Z{z_hop} F300 # move Z to travel height
|
|
{% else %}
|
|
{action_respond_info("Printer not homed")}
|
|
{% endif %}
|
|
|
|
|
|
# CANCEL_PRINT
|
|
[gcode_macro CANCEL_PRINT]
|
|
description: Cancel the actual running print
|
|
rename_existing: _CANCEL_PRINT_BASE
|
|
gcode:
|
|
TURN_OFF_HEATERS
|
|
PARK
|
|
_CANCEL_PRINT_BASE
|
|
|
|
|
|
[gcode_macro M600]
|
|
description: Change filament
|
|
gcode:
|
|
SAVE_GCODE_STATE NAME=M600_state
|
|
PAUSE Y=15
|
|
M117 > change filament
|
|
RESTORE_GCODE_STATE NAME=M600_state
|
|
|
|
|
|
# PARK
|
|
[gcode_macro PARK]
|
|
gcode:
|
|
{% set Y=params.Y|default(295) %}
|
|
{% if "xyz" in printer.toolhead.homed_axes %}
|
|
# set park positon for x and y
|
|
## close to max
|
|
{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
|
|
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
|
|
{% if Y != y_park %}
|
|
{% set y_park = Y %}
|
|
{% endif %}
|
|
# calculate save lift position
|
|
{% set max_z = printer.toolhead.axis_maximum.z|float %}
|
|
{% set act_z = printer.toolhead.position.z|float %}
|
|
{% if act_z < (max_z - 20.0) %}
|
|
{% set z_safe = 20.0 %}
|
|
{% else %}
|
|
{% set z_safe = max_z - act_z %}
|
|
{% endif %}
|
|
G91
|
|
G0 Z{z_safe} F900
|
|
G90
|
|
G0 X{x_park} Y{y_park} F6000
|
|
{% else %}
|
|
{action_respond_info("Printer not homed")}
|
|
{% endif %}
|
|
|
|
|
|
# PAUSE
|
|
[gcode_macro PAUSE]
|
|
description: Pause the actual running print
|
|
rename_existing: _PAUSE_BASE
|
|
# change this if you need more or less extrusion
|
|
variable_extrude: 1.0
|
|
gcode:
|
|
{% set Y=params.Y|default(295) %}
|
|
# read E from pause macro
|
|
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
|
|
# end of definitions
|
|
M117 > pause
|
|
_PAUSE_BASE
|
|
{% if printer.extruder.can_extrude|lower == 'true' %}
|
|
G91
|
|
G1 E-{E} F2100
|
|
G90
|
|
{% else %}
|
|
{action_respond_info("Extruder not hot enough")}
|
|
{% endif %}
|
|
PARK Y={Y}
|
|
|
|
|
|
# - PRINT_START
|
|
[gcode_macro PRINT_START]
|
|
gcode:
|
|
{% set BED=params.BED|default(100)|int %}
|
|
{% set EXTRUDER=params.EXTRUDER|default(250)|int %}
|
|
{% set CHAMBER=params.CHAMBER|default(0)|int %}
|
|
{% set BMC=params.BMC|default(0)|int %}
|
|
{% set QGL=params.QGL|default(0)|int %}
|
|
{% set PURGE=params.PURGE|default(1)|int %}
|
|
{% set SOAK=params.SOAK|default(0)|int * 1000 * 60 %}
|
|
{% set Z_ADJUST=params.Z_ADJUST|default(0.0)|float %}
|
|
# TODO: ERCF
|
|
{% set ERCF=params.ERCF|default(0) %}
|
|
{action_respond_info("starting print BED=%d, EXTRUDER=%d, BMC=%d, PURGE=%d, SOAK=%d, Z_AJUST=%f" % (BED, EXTRUDER, BMC, PURGE, SOAK, Z_ADJUST))}
|
|
M117 > configuring
|
|
SET_LED LED=caselight RED=0.00 GREEN=0.00 BLUE=0.50
|
|
G4 P2000
|
|
SET_GCODE_OFFSET Z=0.0 # reset z offset
|
|
M140 S{BED} # start bed heating
|
|
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
|
|
|
|
M117 > homing
|
|
SET_LED LED=caselight RED=0.00 GREEN=0.50 BLUE=0.00
|
|
G4 P2000
|
|
{% if BMC %}
|
|
BED_MESH_CLEAR
|
|
{% endif %}
|
|
M117 > home
|
|
G28
|
|
BRUSHIE
|
|
{% if QGL %}
|
|
M117 > qgl
|
|
QUAD_GANTRY_LEVEL PARK=false
|
|
BRUSHIE
|
|
{% endif %}
|
|
M117 > calibrate z
|
|
CALIBRATE_Z
|
|
{% if BMC %}
|
|
M117 > bed mesh calibrate
|
|
BED_MESH_CALIBRATE
|
|
{% else %}
|
|
M117 > bed mesh load
|
|
BED_MESH_PROFILE LOAD=default
|
|
{% endif %}
|
|
|
|
M117 > heating
|
|
SET_LED LED=caselight RED=0.50 GREEN=0.00 BLUE=0.00
|
|
G4 P2000
|
|
G92 E0 # reset extruder
|
|
M190 S{BED} # set and wait for bed temperature
|
|
M109 S{EXTRUDER} # set and wait for nozzle temperature
|
|
TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={CHAMBER} # wait for chamber temp
|
|
{% if SOAK > 0 %}
|
|
M117 > soaking for {SOAK/1000/60|int} min
|
|
G4 P{SOAK}
|
|
{% endif %}
|
|
|
|
M117 > starting
|
|
SET_GCODE_OFFSET Z_ADJUST={params.Z_ADJUST|default(0.0)|float} MOVE=1
|
|
SET_LED LED=caselight RED=0.50 GREEN=0.50 BLUE=0.50
|
|
G4 P2000
|
|
{% if PURGE %}
|
|
PURGE_NOZZLE
|
|
{% endif %}
|
|
|
|
|
|
# - PRINT_END
|
|
[gcode_macro PRINT_END]
|
|
gcode:
|
|
M117 > finished
|
|
PARK
|
|
M400 ; wait for buffer to clear
|
|
G92 E0 ; zero the extruder
|
|
G1 E-10.0 F3600 ; retract filament
|
|
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(0) %}
|
|
{% set y1=params.y1|default(0.8) %}
|
|
{% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|int %}
|
|
M117 > purge nozzle
|
|
G0 Z{z_hop} F300 # move Z to travel height
|
|
G0 X{x0} Y{y0} F5000 # move to x0/y0
|
|
G0 Z0.2 F1500 # lower Z
|
|
G0 X{x1} E20 # draw line
|
|
G0 Y{y1} # move to y1
|
|
G0 X{x0} E10 # draw fine line
|
|
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:
|
|
# read E from pause macro
|
|
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
|
|
# get VELOCITY parameter if specified
|
|
{% if 'VELOCITY' in params|upper %}
|
|
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
|
|
{%else %}
|
|
{% set get_params = "" %}
|
|
{% endif %}
|
|
# end of definitions
|
|
M117 > resume
|
|
{% if printer.extruder.can_extrude|lower == 'true' %}
|
|
G91
|
|
G1 E{E} F6000
|
|
{% else %}
|
|
{action_respond_info("Extruder not hot enough")}
|
|
{% endif %}
|
|
_RESUME_BASE {get_params}
|
|
|
|
|
|
[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
|