-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
macros.cfg
165 lines (149 loc) · 4.68 KB
/
macros.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# Own Macros
# Start / End Macros
[gcode_macro _START_PRINT]
description: Executes the start up procedure before the print
gcode:
{% set first_layer_bed = params.FIRST_LAYER_BED | int %}
{% set first_layer_ext = params.FIRST_LAYER_EXT | int %}
{% set print_purge = params.PRINT_PURGE | default('1') | int %}
{ action_respond_info('Execute Start print routine') }
LED_LEVELING
G90 ;Ensure absolute
G21 ;Ensure mm
G28 ;Home Axes
{% set was_preheated = (printer.heater_bed.temperature | float) > (first_layer_bed * 0.8) %}
M140 S{first_layer_bed}
G1 Z20
LED_HEATING
M190 S{first_layer_bed}
{% if not was_preheated %}
G4 S60 ;Wait for heated bed
{% else %}
{ action_respond_info('Halving bed heat up time') }
{% endif %}
TIMELAPSE_TAKE_FRAME
M104 S{first_layer_ext}
G4 S60 ;Wait for heated bed again
M109 S{first_layer_ext}
LED_LEVELING
G28 ;Home Axes
Z_TILT_ADJUST
BED_MESH_CALIBRATE
{% if print_purge > 0 %}
LINE_PURGE
{% else %}
{ action_respond_info('Skipping purge line!') }
{% endif %}
LED_PRINTING
[gcode_macro _END_PRINT]
description: Executes the ending procedure after a print
gcode:
{ action_respond_info('Print Finished') }
TURN_OFF_HEATERS
M107
BED_MESH_CLEAR
G92 E0
G1 E-10 F1800
G91
G1 Z20 F300
M400
G90
TIMELAPSE_TAKE_FRAME
LED_FINISHED
MUSIC_TAKE_ON_ME
M18
TIMELAPSE_RENDER
UPDATE_DELAYED_GCODE ID=POWER_OFF_PRINTER_CHECK DURATION=300 # Checks for Power off after 5 minutes
[gcode_macro CANCEL_PRINT]
rename_existing: CANCEL_PRINT_BASE
gcode:
M300 S200
{ action_respond_info('Print Canceled') }
TURN_OFF_HEATERS
M107
BED_MESH_CLEAR
{% set was_heated = (printer.extruder.temperature | float) > 180 %}
{% if was_heated %}
{ action_respond_info('Move head away from print') }
G92 E0
G1 E-10 F1800
G91
G1 Z20 F300
M400
G90
TIMELAPSE_TAKE_FRAME
{% endif %}
LED_ERROR
M300 S200
M300 S600
M300 S200
M300 S600
M300 S200
M300 S600
M300 S200
M300 S600
M18
{% if was_heated %}
TIMELAPSE_RENDER
{% endif %}
# Debug
[gcode_macro SEARCH_VARS]
description: This macro will allow you to type SEARCH_VARS S={some word} from the terminal and it will respond with all of the matching items in the printer object.
gcode:
{% set search = params.S|lower %}
{% set ns = namespace() %}
{% for item in printer %}
{% if ' ' in item %}
{% set ns.path = ['printer', "['%s']" % (item), ''] %}
{% else %}
{% set ns.path = ['printer.', item, ''] %}
{% endif %}
{% if search in ns.path|lower %}
{ action_respond_info(ns.path|join) }
{% endif %}
{% if printer[item].items() %}
{% for childkey, child in printer[item].items() recursive %}
{% set ns.path = ns.path[:loop.depth|int + 1] %}
{% if ' ' in childkey %}
{% set null = ns.path.append("['%s']" % (childkey)) %}
{% else %}
{% set null = ns.path.append(".%s" % (childkey)) %}
{% endif %}
{% if child is mapping %}
{ loop(child.items()) }
{% else %}
{% if search in ns.path|lower %}
{ action_respond_info("%s : %s" % (ns.path|join, child)) }
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
# Auto Power Off
# Adapted from https://github.com/tinntbg/auto-power-off-klipper
[gcode_macro _POWER_OFF_PRINTER]
description: Powers down the printer
gcode:
{action_call_remote_method("set_device_power", device="printer", state="off")}
[delayed_gcode POWER_OFF_PRINTER_CHECK]
gcode:
{% if printer.idle_timeout.state == "Idle" or printer.idle_timeout.state == "Ready" %}
{% if printer.extruder.temperature < 50.0 and printer.heater_bed.temperature < 60.0 %}
{% if printer.extruder.target == 0.0 and printer.heater_bed.target == 0.0 %}
UPDATE_DELAYED_GCODE ID=POWER_OFF_PRINTER_CHECK DURATION=0
_POWER_OFF_PRINTER
{% else %}
UPDATE_DELAYED_GCODE ID=POWER_OFF_PRINTER_CHECK DURATION=2
{% endif %}
{% else %}
{% if printer.idle_timeout.state == "Printing" %}
UPDATE_DELAYED_GCODE ID=POWER_OFF_PRINTER_CHECK DURATION=0
{% else %}
{% if printer.extruder.target == 0.0 and printer.heater_bed.target == 0.0 %}
UPDATE_DELAYED_GCODE ID=POWER_OFF_PRINTER_CHECK DURATION=2
{% else %}
UPDATE_DELAYED_GCODE ID=POWER_OFF_PRINTER_CHECK DURATION=0
{% endif %}
{% endif %}
{% endif %}
{% endif %}