doom-micron/basic_macros.cfg
2023-07-01 00:21:55 +00:00

196 lines
7.3 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 %}
SET_PIN PIN=TOOLHEAD_LED VALUE=1.00 # Turn on toolhead light
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.6} # Set extruder don't drip temp
SET_DOCKABLE_PROBE AUTO_ATTACH_DETACH=1 # Disable probe attach/detach
ATTACH_PROBE
CLEAN_NOZZLE
FAST_QGL # QGL after soak
BED_MESH_CALIBRATE
DETACH_PROBE # Ensure probe is detached
SET_DOCKABLE_PROBE AUTO_ATTACH_DETACH=1 # Enable probe attach/detach
G90 # Absolute positioning
GO_TO_BUCKET # Move to park position
M109 S{hotendTemp} # Set extruder to printing temperature
CLEAN_NOZZLE # Purge
G1 X{90} F{500*60} # Avoid brush
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 = 5 %} # 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 %}
BEDFANSFAST # Force bed fans to fast speed
# 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:
GO_TO_BUCKET
[gcode_macro GO_TO_BUCKET]
gcode:
{% set X = 18 %}
{% set Y = 184 %}
{% set Z = 2 %}
###########
SAFE_RETRACT
{% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %}
# Tall hop if low
{% if printer.toolhead.position.z < 15 %}
G90
G1 Z15
# Short hop if high
{% elif printer.toolhead.position.z < (max_z - Z - 1) %}
G91
G1 Z{Z}
{% endif %}
G90
G1 X{X} F{500*60}
G1 Y{Y} F{500*60}
G91
[gcode_macro G32]
gcode:
SAVE_GCODE_STATE NAME=STATE_G32
G90
G28
QUAD_GANTRY_LEVEL
G28
PARK
RESTORE_GCODE_STATE NAME=STATE_G32
[gcode_macro PRINT_END]
# Use PRINT_END for the slicer ending script - please customise for your slicer of choice
gcode:
# safe anti-stringing move coords
{% set th = printer.toolhead %}
{% set x_safe = th.position.x + 20 * (1 if th.axis_maximum.x - th.position.x > 20 else -1) %}
{% set y_safe = th.position.y + 20 * (1 if th.axis_maximum.y - th.position.y > 20 else -1) %}
{% set z_safe = [th.position.z + 2, th.axis_maximum.z]|min %}
SAVE_GCODE_STATE NAME=STATE_PRINT_END
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-5.0 F1800 ; retract filament
TURN_OFF_HEATERS
G90 ; absolute positioning
G0 X{x_safe} Y{y_safe} Z{z_safe} F20000 ; move nozzle to remove stringing
G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y - 2} F3600 ; park nozzle at rear
M107 ; turn off fan
BED_MESH_CLEAR
GO_TO_BUCKET
RESTORE_GCODE_STATE NAME=STATE_PRINT_END
SET_PIN PIN=TOOLHEAD_LED VALUE=0.00 ; Turn off toolhead light
[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
[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 FAST_QGL]
gcode:
{% set z_offset = 3.5 %}
# Home first if needed
{% if printer.toolhead.homed_axes != "xyz" %}
G28
{% endif %}
SET_DOCKABLE_PROBE AUTO_ATTACH_DETACH=0
ATTACH_PROBE
QUAD_GANTRY_LEVEL horizontal_move_z={z_offset * 3} retry_tolerance=1
QUAD_GANTRY_LEVEL horizontal_move_z={z_offset + 1.5}
G28 Z
SET_DOCKABLE_PROBE AUTO_ATTACH_DETACH=1
[gcode_macro SAFE_RETRACT]
gcode:
{% if printer.extruder.can_extrude %}
G10
{% endif %}
[gcode_macro SAFE_UNRETRACT]
gcode:
{% if printer.extruder.can_extrude %}
G11
{% endif %}
[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!