Last active
November 17, 2022 22:28
-
-
Save rootiest/dfb1b09de6fe3eb47b173eeab2b38537 to your computer and use it in GitHub Desktop.
Shutdown Scheduler for Klipper
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
#!/bin/bash | |
sleep 30 | |
shutdown now |
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
# Shutdown Scheduler | |
[gcode_shell_command kill_host] | |
command: sh ~/printer_data/config/shutdown.sh | |
[gcode_macro SCHEDULE_SHUTDOWN] | |
description: Schedule shutdown for after print completes | |
variable_do_shutdown: 0 | |
gcode: | |
SET_GCODE_VARIABLE MACRO=SCHEDULE_SHUTDOWN VARIABLE=do_shutdown VALUE=1 | |
[gcode_macro CANCEL_SHUTDOWN] | |
description: Cancel scheduled shutdown | |
gcode: | |
SET_GCODE_VARIABLE MACRO=SCHEDULE_SHUTDOWN VARIABLE=do_shutdown VALUE=0 | |
[gcode_macro END_PRINT] | |
{% set X_MAX = printer.toolhead.axis_maximum.x|default(100)|float %} | |
{% set Y_MAX = printer.toolhead.axis_maximum.y|default(100)|float %} | |
#Fix-up extruder | |
G91 | |
G1 E-2 F2700 | |
G1 E-1.5 Z0.2 F2400 | |
G1 X5 Y5 F6000 | |
G1 Z10 | |
G90 | |
#Present print | |
G1 Z{printer.toolhead.position.z + 10} F600 | |
G1 X{X_MAX / 2} Y{Y_MAX} F6000 | |
M106 S0 | |
M104 S0 | |
M140 S0 | |
M109 S60 | |
#Disable Steppers | |
M84 X Y E | |
{% set scheduled_shutdown = printer["gcode_macro SCHEDULE_SHUTDOWN"].do_shutdown %} | |
{% if scheduled_shutdown == 1 %} | |
RUN_SHELL_COMMAND CMD=kill_host | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment