-
Notifications
You must be signed in to change notification settings - Fork 0
/
timelapse.cfg
193 lines (158 loc) · 5.41 KB
/
timelapse.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
[respond]
[gcode_macro TIMELAPSE_START]
gcode:
RESPOND PREFIX=timelapse MSG=start
[gcode_macro TIMELAPSE_END]
gcode:
RESPOND PREFIX=timelapse MSG=stop
RESPOND PREFIX=timelapse MSG=create
[gcode_macro TIMELAPSE_PAUSE]
gcode:
RESPOND PREFIX=timelapse MSG=pause
[gcode_macro TIMELAPSE_RESUME]
gcode:
RESPOND PREFIX=timelapse MSG=resume
[gcode_macro TIMELAPSE_PHOTO]
gcode:
RESPOND PREFIX=timelapse MSG=photo
[gcode_macro TIMELAPSE_CAPTURE]
variable_delay_before: 500
variable_delay_after: 1500
variable_pause: 0
variable_park: 0
gcode:
{% if park == 0 %}
TIMELAPSE_PHOTO
{% else %}
{% set max_y = printer.toolhead.axis_maximum.y|float %}
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_x = printer.gcode_move.gcode_position.x|float %}
{% set act_y = printer.gcode_move.gcode_position.y|float %}
{% set act_z = printer.gcode_move.gcode_position.z|float %}
{% set park_x = params.PARK_X|default(0)|float %}
{% set park_y = params.PARK_Y|default(max_y - 10)|float %}
{% set retract = params.RETRACT|default(1)|float %}
{% set retract_speed = params.RETRACT_SPEED|default(40)|float %}
{% set retract_fspeed = retract_speed * 60 %}
{% set travel_speed = printer.toolhead.max_velocity|int %}
{% set move_speed = params.MOVE_SPEED|default(travel_speed)|float %}
{% set move_fspeed = move_speed * 60 %}
{% set delay_after = printer["gcode_macro TIMELAPSE_CAPTURE"].delay_after|float %}
{% set delay_before = printer["gcode_macro TIMELAPSE_CAPTURE"].delay_before|float %}
G1 E-{retract} F{retract_fspeed}
{% if (act_z + 20) < max_z %}
{% set new_z = act_z + 20 %}
{% else %}
{% set new_z = max_z %}
{% endif %}
{% if pause == 1 %}
BASE_PAUSE
{% endif %}
G1 X{park_x} Y{park_y} Z{new_z} F{move_fspeed}
M400
{% if pause == 1 %}
G4 P{delay_before}
RESPOND PREFIX=timelapse MSG=photo_and_gcode
{% else %}
G4 P{delay_before}
RESPOND PREFIX=timelapse MSG=photo
G4 P{delay_after}
G1 X{act_x} Y{act_y} Z{act_z} F{move_fspeed}
G1 E{retract} F{retract_fspeed}
{% endif %}
{% endif %}
[gcode_macro TIMELAPSE_RESUME_PRINT]
gcode:
{% set travel_speed = printer.toolhead.max_velocity|int %}
{% set delay_after = printer["gcode_macro TIMELAPSE_CAPTURE"].delay_after|float %}
G4 P{delay_after}
BASE_RESUME VELOCITY={travel_speed}
[gcode_macro TIMELAPSE_SET_CAPTURE_PARAMS]
gcode:
{% for p in params %}
SET_GCODE_VARIABLE MACRO=TIMELAPSE_CAPTURE VARIABLE={p|lower} VALUE={params[p]}
RESPOND MSG="Set {p|lower} to {params[p]}"
{% endfor %}
[gcode_macro TIMELAPSE_SET_PARAMS]
gcode:
RESPOND PREFIX=set_timelapse_params MSG="{rawparams}"
[gcode_macro TIMELAPSE_SET_NOTIFY_PARAMS]
gcode:
RESPOND PREFIX=set_notify_params MSG="{rawparams}"
# [gcode_macro START_TIMELAPSE]
# gcode:
# RESPOND PREFIX=timelapse MSG=start
# [gcode_macro END_TIMELAPSE]
# gcode:
# RESPOND PREFIX=timelapse MSG=stop
# RESPOND PREFIX=timelapse MSG=create
# [gcode_macro PAUSE_TIMELAPSE]
# gcode:
# RESPOND PREFIX=timelapse MSG=pause
# [gcode_macro RESUME_TIMELAPSE]
# gcode:
# RESPOND PREFIX=timelapse MSG=resume
# [gcode_macro ENABLE_TIMELAPSE]
# gcode:
# SET_GCODE_VARIABLE MACRO=CHECK_CAPTURE_TIMELAPSE VARIABLE=enabled VALUE=1
# [gcode_macro DISABLE_TIMELAPSE]
# gcode:
# SET_GCODE_VARIABLE MACRO=CHECK_CAPTURE_TIMELAPSE VARIABLE=enabled VALUE=0
# [gcode_macro TIMELAPSE_PHOTO]
# gcode:
# RESPOND PREFIX=timelapse MSG=photo
# [gcode_macro CHECK_CAPTURE_TIMELAPSE]
# variable_enabled: 0
# gcode:
# {% if enabled %}
# CAPTURE_TIMELAPSE {rawparams}
# {% endif %}
# [gcode_macro CAPTURE_TIMELAPSE]
# gcode:
# {% set travel_speed = printer.toolhead.max_velocity|int %}
# {% set max_x = printer.toolhead.axis_maximum.x|float %}
# {% set max_y = printer.toolhead.axis_maximum.y|float %}
# {% set max_z = printer.toolhead.axis_maximum.z|float %}
# {% set act_x = printer.toolhead.position.x|float %}
# {% set act_y = printer.toolhead.position.y|float %}
# {% set act_z = printer.toolhead.position.z|float %}
# {% set pause = params.PAUSE|default(0)|int %}
# {% set park_x = params.PARK_X|default(max_x)|float %}
# {% set park_y = params.PARK_Y|default(max_y)|float %}
# {% set lift_z = params.LIFT_Z|default(5)|float %}
# {% set retract = params.RETRACT|default(1.5)|float %}
# {% set retract_speed = params.RETRACT_SPEED|default(40)|float %}
# {% set retract_fspeed = retract_speed * 60 %}
# {% set delay = params.DELAY|default(700)|float %}
# {% set move_speed = params.MOVE_SPEED|default(travel_speed)|float %}
# {% set move_fspeed = move_speed * 60 %}
# {% if (act_z + lift_z) < max_z %}
# {% set new_z = act_z + lift_z %}
# {% else %}
# {% set new_z = max_z %}
# {% endif %}
# G1 E-{retract} F{retract_fspeed}
# {% if pause == 1 %}
# BASE_PAUSE
# {% endif %}
# G1 X{park_x} Y{park_y} Z{new_z} F{move_fspeed}
# M400
# {% if pause == 1 %}
# RESPOND PREFIX=timelapse MSG=photo_and_gcode
# {% else %}
# G4 P300
# RESPOND PREFIX=timelapse MSG=photo
# G4 P{delay}
# G1 X{act_x} Y{act_y} Z{act_z} F{move_fspeed}
# G1 E{retract} F{retract_fspeed}
# {% endif %}
# [gcode_macro TIMELAPSE_RESUME]
# gcode:
# {% set travel_speed = printer.toolhead.max_velocity|int %}
# BASE_RESUME VELOCITY={travel_speed}
# [gcode_macro SET_TIMELAPSE_PARAMS]
# gcode:
# RESPOND PREFIX=set_timelapse_params MSG="{rawparams|lower}"
# [gcode_macro SET_TIMELAPSE_NOTIFY_PARAMS]
# gcode:
# RESPOND PREFIX=set_notify_params MSG="{rawparams|lower}"