tri-zero/basic_macros.cfg
2023-05-14 19:57:58 -07:00

168 lines
5.7 KiB
INI

[gcode_macro PRINT_START]
# Use PRINT_START for the slicer starting script - please customize for your slicer of choice
gcode:
# Parameters
{% set bedTemp = params.BED|int %}
{% set hotendTemp = params.HOTEND|int %}
{% set Z = 200 %}
M104 S{hotendTemp|float*0.8} ; set extruder pre warm temp
M140 S{bedTemp} ; set bed temp to warm while starting up
G28 ; home after setting temps
#G1 Z20 F3000 ; move nozzle away from bed
G90 ; absolute positioning
M117 Waiting for temperatures...
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={bedTemp} MAXIMUM={bedTemp+1} ; Wait for bed temp (within 1 degree)
BED_MESH_CALIBRATE
G1 X0 Y0 Z0.2 F20000 ; park nozzle on bed to prevent ooze
M109 S{hotendTemp} ; Set extruder to printing temperature
PURGE
[gcode_macro PARK]
gcode:
G91 ; relative positioning
# Get Boundaries
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
{% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %}
# Check end position to determine safe direction to move
{% if printer.toolhead.position.x < (max_x - 20) %}
{% set x_safe = 20.0 %}
{% else %}
{% set x_safe = -20.0 %}
{% endif %}
{% if printer.toolhead.position.y < (max_y - 20) %}
{% set y_safe = 20.0 %}
{% else %}
{% set y_safe = -20.0 %}
{% endif %}
{% if printer.toolhead.position.z < (max_z - 2) %}
{% set z_safe = 2.0 %}
{% else %}
{% set z_safe = max_z - printer.toolhead.position.z %}
{% endif %}
G0 Z{z_safe} F3600 ; move nozzle up
G0 X{x_safe} Y{y_safe} F20000 ; move nozzle to remove stringing
G90 ; absolute positioning
G0 X60 Y{max_y} F3600 ; park nozzle at rear
[gcode_macro PRINT_END]
# Use PRINT_END for the slicer ending script - please customize for your slicer of choice
gcode:
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-4.0 F3600 ; retract filament
PARK
SET_IDLE_TIMEOUT TIMEOUT=1800 ; restore idle timeout
TURN_OFF_HEATERS
BED_MESH_CLEAR
M107 ; turn off fan
[gcode_macro LOAD_FILAMENT]
gcode:
{% if printer.extruder.can_extrude|lower != 'true' %} # checing for minimum extrusion temperature
# check if temperature is over the minimum extrusion temp. min_extrude_temp must be defined in the extruder config (to about 185)
M104 S235 T0 # set temperature and wait, 235 deg C is a good value for most of filament types.
{% endif %}
M117 Filament loading!
M118 Filament loading!
M82 #set extruder to absolute mode
G92 E0
G4 P2000 # wait for two seconds
# check for extruder ready - hotend temperature is high enough, extrude 50mm then check temperature again. To avoid cold extrusion when filament load was started with hot hotend but temperature set to 0
{% if printer.extruder.can_extrude|lower != 'true' %} # checing for minimum extrusion temperature
# check if temperature is over the minimum extrusion temp. min_extrude_temp must be defined in the extruder config (to about 185)
M118 Hotend heating!
M109 S235 T0 # set temperature and wait, 235 deg C is a good value for most of filament types.
{% endif %}
G1 E200 F300 # extrude 200mm
M400
M117 Filament load complete!
M118 Filament load complete!
[gcode_macro UNLOAD_FILAMENT]
gcode:
M118 Filament unloading!
M117 Filament unloading!
M82 #set extruder to absolute mode
G92 E0
{% if printer.extruder.can_extrude|lower != 'true' %} # checing for minimum extrusion temperature
# check if temperature is over the minimum extrusion temp. min_extrude_temp must be defined in the extruder config (to about 185)
M118 Hotend heating!
M109 S235 T0 # set temperature and wait
{% endif %}
G1 E10 F{5*60} # extrude a little to soften tip
G0 E-5 F{60*60} # extract filament to cold end
G0 E-70 F{5*60} # continue extraction slow allow filament to be cooled enough before reaches the gears
M400
M118 Filament unload complete!
M117 Filament unload complete!
[gcode_macro PURGE]
gcode:
G92 E0
M117 Purging Nozzle...
G1 X1.5 Y1 Z0.2
G1 E10 F{10*60} ; Prepurge in place before line
G1 X1.5 Y100 E15 F{10*60}
G1 X2 Y100 F{10*60}
G1 X2 Y50 E10 F{10*60}
G92 E0
M117 Printing...
[gcode_macro PID_HOTEND]
gcode:
PID_CALIBRATE HEATER=extruder TARGET=260
[gcode_macro PID_BED]
gcode:
PID_CALIBRATE HEATER=heater_bed TARGET=110
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
TURN_OFF_HEATERS
CLEAR_PAUSE
SDCARD_RESET_FILE
BASE_CANCEL_PRINT
BED_MESH_CLEAR
SET_IDLE_TIMEOUT TIMEOUT=600 # restore idle timeout
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
#Edit this#
#{% set bound = params.BOUND|default(5)|int %}
#{% set X = printer.toolhead.axis_minimum.x + bound %}
#{% set Y = printer.toolhead.axis_maximum.y - bound %}
#{% set Z = bound %}
###########
SAVE_GCODE_STATE NAME=PAUSE_state
G1 E-1.7 F2100
PARK
BASE_PAUSE
#G91
#G1 Z{Z}
#G90
#G1 X{X} Y{Y} F6000
#G91
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
G91
G1 E1.7 F2100
G91
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME
[gcode_macro CALIBRATE_PROBE]
gcode:
G90
G0 X72.4 Y38.6
PROBE_CALIBRATE