Created
February 17, 2022 16:26
-
-
Save ryanwilson/e946e842f9817e30dbc3aa3c1cb13326 to your computer and use it in GitHub Desktop.
Klipper Macro Examples
This file contains hidden or 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
Description: allows you to select if you'd like to have the filament unloaded at the end | |
of the print, or for it to stay in the hotend. Defaults to staying in the hotend. | |
In your `PRINT_END` macro, add this variable: | |
``` | |
[gcode_macro PRINT_END] | |
# Keeps track of whether filament should be unloaded or kept at the end of the print. | |
variable_keep_printing: True | |
``` | |
Then, in the `gcode:` section before `TURN_OFF_HEATERS`, add this snippet to read the | |
variable and take action if needed: | |
``` | |
{% if keep_printing == False %} | |
{action_respond_info("Done printing for now, unloading filament.")} | |
G92 E0 ; zero the extruder | |
# Retract as many times as you need, this is to avoid exceeding the default limit | |
# of 50mm extrusions at one time. | |
G1 E-50.0 F3600 ; retract filament multiple times | |
G1 E-50.0 F3600 ; retract filament multiple times | |
G1 E-50.0 F3600 ; retract filament multiple times | |
# TODO: Clear keep printing flag | |
{% endif %} | |
``` | |
Then, add the macros to set/reset the variable. | |
``` | |
[gcode_macro SET_KEEP_PRINTING] | |
# Keep printing after this print! | |
gcode: | |
SET_GCODE_VARIABLE MACRO=PRINT_END VARIABLE=keep_printing VALUE=True | |
{action_respond_info("Will not unload filament after this print.")} | |
[gcode_macro SET_UNLOAD_AFTER_PRINT] | |
# Keep printing after this print! | |
gcode: | |
SET_GCODE_VARIABLE MACRO=PRINT_END VARIABLE=keep_printing VALUE=False | |
{action_respond_info("Will unload filament after this print.")} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment