tri-zero/basic_macros.cfg
2024-11-05 10:06:43 -08:00

245 lines
10 KiB
INI

[gcode_macro PRINT_START]
# Use PRINT_START for the slicer starting script - please customize for your slicer of choice
gcode:
# Slicer Parameters
{% set hotendTemp = params.HOTEND|int %}
{% set bedTemp = params.BED|int %}
{% set chamberTemp = params.CHAMBER|default(0)|int %}
# User Parameters
{% set x_park = 20 %}
{% set y_park = 0 %}
{% set z_park = 0.3 %}
{% set travel_speed = 300 %} # in mm/s
{% set z_speed = 5 %} # in mm/s
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={hotendTemp|float*0.6} # Set extruder chamber warm temp
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={bedTemp} # Set bed temp to warm while starting up
SET_DOCKABLE_PROBE AUTO_ATTACH_DETACH=1 # Disable probe attach/detach
G28 # home after setting temps
M117 Waiting for bed temperature...
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={bedTemp} MAXIMUM={bedTemp+1} # Wait for bed temp (within 1 degree)
{% if chamberTemp != 0 %} # If chamber temp set
CHAMBER_WARMER TEMPERATURE={chamberTemp} # Warm chamber
{% endif %}
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={hotendTemp|float*0.8} # Set extruder don't drip temp
SET_DOCKABLE_PROBE AUTO_ATTACH_DETACH=1 # Disable probe attach/detach
ATTACH_PROBE
FAST_TILT # Z-Tilt after soak
ATTACH_PROBE
BED_MESH_CALIBRATE
DETACH_PROBE # Ensure probe is detached
SET_DOCKABLE_PROBE AUTO_ATTACH_DETACH=1 # Enable probe attach/detach
G90 # Absolute positioning
G1 X{x_park} Y{y_park} F{travel_speed * 60} # Move to park position
G1 X{x_park} Y{y_park} Z{z_park} F{z_speed * 60} # Park nozzle on bed to prevent ooze
M109 S{hotendTemp} # Set extruder to printing temperature
PURGE_X # Purge
M117 Printing...
[gcode_macro CHAMBER_WARMER]
description: Uses the bed and part cooling fan to warm the chamber
gcode:
# User Parameters
{% set z_pcf_height = 3 %} # Height from the bed while warming
{% set fan_speed = 100 %} # Fan speed in percent
{% set chamberTemp = params.TEMPERATURE|default(0)|int %}
{% if printer["temperature_sensor chamber"].temperature < chamberTemp %}
# Only move and turn on fan if chamber is not to temp.
G90 # Absolute positioning
# park above bed center
G1 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_maximum.y/2} Z{z_pcf_height}
M106 S{fan_speed / 100 * 255} # Max out part cooling to cycle chamber air
M117 Waiting for chamber temperature {chamberTemp}c...
TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={chamberTemp} # Wait for chamber temp
M106 S0 # Disable part cooling fan after soak
{% endif %}
M117 Chamber at temp
[gcode_macro PARK]
gcode:
# User Parameters
{% set travel_speed = 300 %} # in mm/s
{% set z_speed = 5 %} # in mm/s
{hotendTemp} ; Set extruder to printing temperature
{% set x_park = 0 %}
{% set y_park = 40 %}
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 - 30) %}
{% set x_safe = 30.0 %}
{% else %}
{% set x_safe = -30.0 %}
{% endif %}
{% if printer.toolhead.position.y < (max_y - 90) %}
{% set y_safe = 30.0 %}
{% else %}
{% set y_safe = -30.0 %}
{% endif %}
{% if printer.toolhead.position.z < (max_z -30) %} # Overshoot for homing retract
{% set z_safe = 10.0 %}
{% else %}
{% set z_safe = max_z - printer.toolhead.position.z %}
{% endif %}
G0 Z{z_safe} F{z_speed * 60} # Move nozzle up
G0 X{x_safe} Y{y_safe} F{travel_speed * 60} # Move nozzle to remove stringing
G90 # Absolute positioning
G0 X{x_park} Y{y_park} F{travel_speed * 60} # Park nozzle
[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 # Park out of the way
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=0 # Set extruder pre warm temp
#TURN_OFF_HEATERS # Don't turn off heaters. Idle is responsible for this
BED_MESH_CLEAR # Ensure no bed mesh sneaks through
M107 # Turn off fan
[gcode_macro LOAD_FILAMENT]
gcode:
{% if printer.extruder.can_extrude|lower != 'true' %} # Checking 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' %} # Checking 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' %} # Checking 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_X]
description: Purges along X in the positive direction, and half a line back
gcode:
# User parameters
{% set x_start = 20 %}
{% set y_start = 0 %}
{% set z = 0.3 %}
{% set length = 85 %}
G92 E0 # Reset extruder position
M117 Purging Nozzle...
G1 X{x_start} Y{y_start} Z{z} # Go to starting position
G1 E10 F{10*60} # Prepurge in place before line
G1 X{x_start + length} Y{y_start} E20 F{15*60} # Purge length in positive Y
G1 X{x_start + length} Y{y_start + 0.5} E20 F{15*60} # Move 0.5 positive in X for return line
G1 X{x_start + length / 2} Y{y_start + 0.5} E20 F{10*60} # Purge half a line the other direction
G92 E0 # Reset extruder position
[gcode_macro PURGE_Y]
description: Purges along Y in the positive direction, and half a line back
gcode:
# User parameters
{% set x_start = 1 %}
{% set y_start = 20 %}
{% set z = 0.3 %}
{% set length = 85 %}
G92 E0 # Reset extruder position
M117 Purging Nozzle...
G1 X{x_start} Y{y_start} Z{z} # Go to starting position
G1 E10 F{10*60} # Prepurge in place before line
G1 X{x_start} Y{y_start + length} E20 F{15*60} # Purge length in positive Y
G1 X{x_start + 0.5} Y{y_start + length} E20 F{15*60} # Move 0.5 positive in X for return line
G1 X{x_start + 0.5} Y{y_start + length / 2} E20 F{15*60} # Purge half a line the other direction
G92 E0 # Reset extruder position
[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
[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 X50 Y60.4
PROBE_CALIBRATE
[gcode_macro BATCH_PRINT_MODE]
gcode:
SET_IDLE_TIMEOUT TIMEOUT=1800
[gcode_macro SINGLE_PRINT_MODE]
gcode:
SET_IDLE_TIMEOUT TIMEOUT=120