-
Notifications
You must be signed in to change notification settings - Fork 4
/
print_macro.cfg
157 lines (124 loc) · 4.27 KB
/
print_macro.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
[gcode_macro START_PRINT]
variable_filament_diameter: 1.75
gcode:
{% set x_park_d = printer.toolhead.axis_minimum.x|float + 10 %}
{% set y_park_d = printer.toolhead.axis_maximum.y|float - 10 %}
{% set travel_speed = printer.toolhead.max_velocity|int %}
{% set extruder_t = params.EXTRUDERT|float %}
{% set bed_t = params.BEDT|float %}
{% set first_layer_speed = params.FIRSTS|float %}
{% set extruder_preheat_delta = params.EXTRUDERPD|default(60)|float %}
{% set x_park = params.PARKX|default(x_park_d)|float %}
{% set y_park = params.PARKY|default(y_park_d)|float %}
{% set z_park = params.PARKZ|default(50)|float %}
{% set filament_d = params.FILAMENT_DIAMETER|default(1.75)|float %}
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=filament_diameter VALUE={filament_d}
{% if "TOTAL_LAYER" in params %}
SET_PRINT_STATS_INFO TOTAL_LAYER={params.TOTAL_LAYER}
{% endif %}
{% set prepare_b = bed_t|int|string not in printer.bed_mesh.profiles %}
{% if prepare_b == True %}
M118 Bed mesh will be prepared for {bed_t}
{% else %}
M118 Activating bed mesh: {bed_t}
BED_MESH_PROFILE LOAD={bed_t|int}
{% endif %}
CLEAR_PAUSE
M117 Starting
G21 ; set units to millimeters
G90 ; use absolute coordinates
M83 ; extruder relative mode
M140 S{bed_t} ; set bed temp
{% set extruder_preheat_t = extruder_t - extruder_preheat_delta %}
{% if not prepare_b and printer.extruder.temperature > extruder_preheat_t %}
PREHEAT HEATER=extruder TARGET={extruder_t} ; set extruder temp
{% else %}
PREHEAT HEATER=extruder TARGET={extruder_preheat_t} ; set extruder temp
{% endif %}
G28
G1 X{x_park} Y{y_park} Z{z_park} F{travel_speed * 60}
{% if printer.heater_bed.target != bed_t %}
M117 Waiting for bed temp
M190 S{bed_t} ; wait for bed temp
G4 P{60 * 1000}
{% endif %}
Z_TILT_ADJUST
G28 Z
{% if prepare_b %}
PREPARE_BED
G28 Z
{% endif %}
G1 X56 Y-10 Z{z_park} F{travel_speed * 60}
M117 Waiting for extruder temp
M109 S{extruder_t} ; wait for extruder temp
PRINT_INTRO_LINE SPEED=80
M117 Printing
TIMELAPSE_START
[gcode_macro PRINT_INTRO_LINE]
gcode:
{% set travel_speed = printer.toolhead.max_velocity|int %}
{% set speed = params.SPEED|float %}
{% set retract = 1 %}
{% set retract_speed = 30 %}
{% set wipe_amount = 40 / printer["gcode_macro START_PRINT"].filament_diameter|float %}
M117 Printing intro line
G1 X56 Y-5 F{travel_speed * 60}
G1 Z-1 F{travel_speed * 60}
G1 Y3 E{wipe_amount} F60
# G1 E-{retract} F{retract_speed * 60}
G1 Z0.28 F{travel_speed * 60}
# G1 E-0.2 F60
# G1 X180 E10 F{speed * 60} ; intro line
# G1 Y4 F{travel_speed * 60}
# G92 E0
# G1 X60 E10 F{speed * 60} ; intro line
# G92 E0
[gcode_macro PREPARE_BED]
gcode:
{% set travel_speed = printer.toolhead.max_velocity|int %}
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% else %}
G28 Z
{% endif %}
M117 Calibrating bed mesh
BED_MESH_CALIBRATE
BED_MESH_PROFILE SAVE={printer.heater_bed.target|int}
[gcode_macro END_PRINT]
gcode:
{% set retract = params.RETRACT_DIST|default(2)|float %}
{% set extrude_speed = params.RETRACT_SPEED|default(40)|float %}
{% set z_lift = params.Z_LIFT|default(100)|float %}
{% set travel_speed = printer.toolhead.max_velocity|int %}
{% set z_speed = printer.configfile.config.printer.max_z_velocity|int %}
{% set x_park = printer.toolhead.axis_minimum.x|float + 5 %}
{% set y_park = printer.toolhead.axis_maximum.y|float %}
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float - 1 %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - 10.0) %}
{% set z_safe = act_z + 10.0 %}
{% else %}
{% set z_safe = max_z %}
{% endif %}
##### end of definitions #####
G92 E0
M83
M117 Print finished
G1 E-{retract} F{extrude_speed * 60}; retract
G1 Z{z_safe} F{z_speed * 60}
G1 X{x_park} Y{y_park} F{travel_speed * 60}
M400
G4 P1000
TIMELAPSE_PHOTO
TIMELAPSE_END
M140 S0 ; turn off heatbed
M104 S0 ; turn off temperature
M107 ; turn off fan
M84 ; disable motors
POWER_LOSS_CLEAR
M117
[gcode_macro AFTER_LAYER_CHANGE]
gcode:
SET_PRINT_STATS_INFO CURRENT_LAYER={params.CURRENT_LAYER}
M117 Layer {params.CURRENT_LAYER}/{printer.print_stats.info.total_layer}