-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_to_printer.cfg
132 lines (108 loc) · 6.1 KB
/
add_to_printer.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
[gcode_macro START_PRINT]
gcode:
G92 E0 ; Reset Extruder
G28 ; Home all axes
BED_MESH_PROFILE LOAD=default ; comment out if auto bed leveling is not available
M104 S{ params.STANDBY_TEMP } ; Start heating up the nozzle most of the way
M190 S{ params.BED_TEMP } ; Start heating the bed, wait until target temperature reached
M109 S{ params.EXTRUDER_TEMP } ; Finish heating the nozzle
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
# -------- Nozzle Prime -----------
# G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
# G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
# G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
# G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
# G92 E0 ; Reset Extruder
# G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
# G1 X5 Y20 Z0.3 F5000.0 ; Move over to prevent blob squish
[gcode_macro END_PRINT]
gcode:
{ action_respond_info("Completed print sequence...") }
M106 S0 ;Turn-off fan
M104 S0 ;Turn-off hotend
M140 S0 ;Turn-off bed
M84 X Y E ;Disable all steppers but Z
[sdcard_loop] # use to enable looping functionality
[gcode_macro WIPE_OUT]
gcode:
# Go up and out from the finished print, then move the bed forward to present print
G91 ;Relative positioning
G1 E-2 F2700 ;Retract a bit
G1 E-2 Z0.2 F2400 ;Retract and raise Z
G1 X5 Y5 F3000 ;Wipe out
G1 Z10 ;Raise Z more
G90 ;Absolute positioning
G1 X0 Y225 ;Present print
[gcode_macro COOLDOWN]
variable_extruder_temp: 0
variable_bed_temp: 0
gcode:
# Side note, if the cool down temps are set below ambient temperature, then the printer could hang in the COOLDOWN macro indefinitly due to the TEMPERATURE_WAIT macro
# Klipper will need restarted if this happens
{% if printer["gcode_macro COOLDOWN"].extruder_temp > 0 and printer["gcode_macro COOLDOWN"].bed_temp > 0 %}
{ action_respond_info("Cooling Down...") }
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={ printer["gcode_macro COOLDOWN"].extruder_temp }
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={ printer["gcode_macro COOLDOWN"].bed_temp }
TEMPERATURE_WAIT SENSOR=heater_bed MAXIMUM={ printer["gcode_macro COOLDOWN"].bed_temp + 1}
{% endif %}
[gcode_macro PRINT_FINISHED]
variable_counter: 0
gcode:
WIPE_OUT
{ action_respond_info("Print finished (%d/%d)" % (printer["gcode_macro PRINT_FINISHED"].counter + 1, printer["gcode_macro LOOP"].quantity)) }
# disable clear bed on last print
{% if printer["gcode_macro PRINT_FINISHED"].counter + 1 == printer["gcode_macro LOOP"].quantity %}
SET_GCODE_VARIABLE MACRO=LOOP VARIABLE=clear_bed_enabled VALUE=0
{% endif %}
SET_GCODE_VARIABLE MACRO=PRINT_FINISHED VARIABLE=counter VALUE={ printer["gcode_macro PRINT_FINISHED"].counter + 1 }
CLEAR_BED
[gcode_macro CLEAR_BED]
gcode:
# only clear bed if enabled
{% if printer["gcode_macro LOOP"].clear_bed_enabled > 0 %}
COOLDOWN
{ action_respond_info("Clearing bed...") }
; --- begin clearing print ---
# bed clearing script will vary based on configuration of printer, part location on the bed, bed clips (if any), etc..
G90
G1 X120.0 Y230.0 Z1.0 F3000 ; get behind part
G1 Y0.0 F3000 ; push part off bed
G1 Y20.0 F3000 ; come back to avoid collision with bed clip
G1 X0.0 F3000 ; move extruder out of way
G1 Y150.0 F3000 ; push further
G1 Y0.0 F3000 ; come back to basically home pos
{% endif %}
[gcode_macro LOOP]
variable_quantity: 1 # default quantity should be 1 everywhere, else prints from slicer (that do not set params for LOOP) will have issues.
# Side note: setting to 0 in parameters will print the same file indefinitly, as described in the klipper docs for the SDCARD_LOOP_BEGIN macro.
variable_filename: '' # filename should not contain spaces to function properly
variable_clear_bed_enabled: 0 # init value does not matter, clear bed is enabled by default and disabled on the last print (if only printing 1 part, clear bed is disabled)
gcode:
{% set TARGET_QUANTITY = params.QUANTITY | default(1) | int %}
SET_GCODE_VARIABLE MACRO=LOOP VARIABLE=quantity VALUE={ TARGET_QUANTITY }
{% set FILENAME = params.FILENAME %}
SET_GCODE_VARIABLE MACRO=LOOP VARIABLE=filename VALUE='"{ FILENAME }"'
# {% set CLEAR_BED_ENABLED = params.CLEAR_BED_ENABLED | default(1) | int %}
# SET_GCODE_VARIABLE MACRO=LOOP VARIABLE=clear_bed_enabled VALUE={ CLEAR_BED_ENABLED }
# Uncomment above and comment out below if clear_bed_enabled should be a parameter, personal preference
SET_GCODE_VARIABLE MACRO=LOOP VARIABLE=clear_bed_enabled VALUE=1 # clear bed enabled by default
# standby temperature for the extruder while the bed cools
{% set COOLDOWN_EXTRUDER_TEMP = params.COOLDOWN_EXTRUDER_TEMP | default(175) | float %}
SET_GCODE_VARIABLE MACRO=COOLDOWN VARIABLE=extruder_temp VALUE={ COOLDOWN_EXTRUDER_TEMP }
# bed cooldown temp should be low enough to easily remove part via the CLEAR_BED macro
{% set COOLDOWN_BED_TEMP = params.COOLDOWN_BED_TEMP | default(50) | float %}
SET_GCODE_VARIABLE MACRO=COOLDOWN VARIABLE=bed_temp VALUE={ COOLDOWN_BED_TEMP }
SDCARD_PRINT_FILE FILENAME={ FILENAME } # start printing the given file
[gcode_macro START_LOOP]
gcode:
{% if printer["gcode_macro LOOP"].filename != '' %}
{ action_respond_info("Starting continuous print sequence: " + printer["gcode_macro LOOP"].filename) }
# if filename is empty, then print was initiated via slicer or fluidd, and not the LOOP macro
{% endif %}
SET_GCODE_VARIABLE MACRO=PRINT_FINISHED VARIABLE=counter VALUE=0 # reset the counter value when starting a new print/sequence
SDCARD_LOOP_BEGIN COUNT={ printer["gcode_macro LOOP"].quantity }
[gcode_macro STOP_LOOPING]
gcode:
{ action_respond_info("Ending continuous print sequence, current print will continue until finished...") }
SET_GCODE_VARIABLE MACRO=LOOP VARIABLE=clear_bed_enabled VALUE=0 # last iteration, leave part on bed
SDCARD_LOOP_DESIST # Complete existing loop without further iterations.