Last active
February 7, 2024 23:27
-
-
Save justheath/82592c6ce0aa1a7be46438a106c1698f to your computer and use it in GitHub Desktop.
klipper macros
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let's see if putting macros in a separate file is helpful | |
# ------------------------- Filament Change -------------------------- | |
# M600: Filament Change. This macro will pause the printer, move the | |
# tool to the change position, and retract the filament 50mm. Adjust | |
# the retraction settings for your own extruder. After filament has | |
# been changed, the print can be resumed from its previous position | |
# with the "RESUME" gcode. | |
[gcode_macro M600] | |
description: Change Filament | |
variable_parameter_x: 50 | |
variable_parameter_y: 0 | |
variable_parameter_z: 10 | |
gcode: | |
SAVE_GCODE_STATE NAME=M600_state | |
PAUSE | |
G91 | |
G1 E-.8 F2700 | |
G1 Z{z} | |
G90 | |
G1 X{x} Y{y} F3000 | |
G91 | |
G1 E-50 F1000 | |
RESTORE_GCODE_STATE NAME=M600_state | |
# -------------------------------------------------------------------- | |
# ------------------Map G29 to load the default mesh profile --------- | |
[gcode_macro G29] | |
description: Load default mesh profile | |
gcode: | |
BED_MESH_PROFILE load=default | |
# -------------------------------------------------------------------- | |
# --------------------Turn Fan On------------------------------------- | |
[gcode_macro PART_COOLING_FAN_ON] | |
gcode: | |
M106 S255 | |
# --------------------Turn Fan Off------------------------------------ | |
[gcode_macro PART_COOLING_FAN_OFF] | |
gcode: | |
M106 S0 | |
# -------------------------------------------------------------------- | |
# --------------------Prime the Nozzle - Draw lines------------------- | |
[gcode_macro PRIME_EXTRUDER] | |
description: Move to left and draw a line to prime extruder | |
gcode: | |
SAVE_GCODE_STATE NAME=prime_extruder_state | |
# Reset Extruder | |
G92 E0 | |
# Move Z Axis up | |
G1 Z2.0 F3000 | |
# Move to start position | |
G1 X2.1 Y20 Z0.28 F5000.0 | |
# Draw the first line | |
G1 X2.1 Y200.0 Z0.28 F1500.0 E15 | |
# Move to side a little | |
G1 X2.4 Y200.0 Z0.28 F5000.0 | |
# Draw the second line | |
G1 X2.4 Y20 Z0.28 F1500.0 E30 | |
# Reset Extruder | |
G92 E0 | |
# Move Z Axis up | |
G1 Z2.0 F3000 | |
RESTORE_GCODE_STATE NAME=prime_extruder_state | |
# Print message on LCD | |
M117 On your marks, get set... GO! | |
# -------------------------------------------------------------------- | |
# -------------Things to do at Start - Referenced by Slicer----------- | |
[gcode_macro START_PRINT] | |
variable_bed_temp: 60 | |
variable_extruder_temp: 200 | |
gcode: | |
# Home the printer | |
G28 | |
# Load Mesh Bed Level | |
G29 | |
# Start bed heating | |
M117 Heating bed | |
M140 S{bed_temp} | |
# Use absolute coordinates | |
G90 | |
# Reset the G-Code Z offset (adjust Z offset if needed) | |
# Sets current position as "virtual" 0 for future commands | |
SET_GCODE_OFFSET Z=-0.005 | |
# Move the nozzle near the bed | |
G1 Z5 F3000 | |
# Move the nozzle very close to the bed | |
G1 Z0.15 F300 | |
# Wait for bed to reach temperature | |
M190 S{bed_temp} | |
# Start nozzle heating | |
M117 Heating nozzle | |
M104 S{extruder_temp} | |
# Set and wait for nozzle to reach temperature | |
M109 S{extruder_temp} | |
# Prime line | |
PRIME_EXTRUDER | |
M117 Printing... | |
# -------------------------------------------------------------------- | |
# -------------Things to do at End - Referenced by Slicer------------- | |
[gcode_macro END_PRINT] | |
description: Stuff to do when the print is done | |
variable_machine_depth: 235 | |
gcode: | |
# Turn off bed, extruder, and fan | |
M140 S0 | |
M104 S0 | |
M106 S0 | |
# Relative positionning | |
G91 | |
# Retract and raise Z | |
G1 Z0.2 E-2 F2400 | |
# Wipe out | |
G1 X5 Y5 F3000 | |
# Raise Z more | |
G1 Z10 | |
# Absolute positionning | |
G90 | |
# Present print | |
G1 X0 Y{machine_depth} | |
# Disable steppers | |
M84 | |
# Print message on LCD | |
M117 That's All Folks | |
# -------------------------------------------------------------------- | |
# -------------------------------------------------------------------- | |
# -------------------------------------------------------------------- | |
# -------------------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment