forked from ghzserg/base
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase_mod.cfg
More file actions
271 lines (232 loc) · 10.6 KB
/
base_mod.cfg
File metadata and controls
271 lines (232 loc) · 10.6 KB
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# (C) 2024-2026 ghzserg https://zmod.link/
[respond]
[include base.cfg]
[zmod]
screen: True
[gcode_macro RESUME]
description: ===Resume print===
rename_existing: RESUME_BASE
gcode:
ZCONTROL_ON
RUN_SHELL_COMMAND CMD=zsend PARAMS="M24"
# RESUME_BASE
M400
[gcode_macro PAUSE]
description: ===Pause print===
rename_existing: PAUSE_BASE
gcode:
{% set midi_pause = printer.save_variables.variables['midi_pause']|default("") | string %}
{% if midi_pause != "" %}
PLAY_MIDI FILE={midi_pause}
{% endif %}
RUN_SHELL_COMMAND CMD=zsend PARAMS="M25"
UPDATE_DELAYED_GCODE ID=_GOTO_PAUSE DURATION=10
ZCONTROL_OFF
# PAUSE_BASE
[gcode_macro M25]
description: ===Pause print===
rename_existing: M25.1
gcode:
ZCONTROL_OFF
M25.1
UPDATE_DELAYED_GCODE ID=_GOTO_PAUSE DURATION=10
[gcode_macro CANCEL_PRINT]
description: ===Cancel print===
rename_existing: CANCEL_PRINT_BASE
gcode:
{% set cancel_send = printer["gcode_macro _CANCEL_PRINT"].cancel_send %}
{% if cancel_send == 1 %}
RESPOND TYPE=echo MSG="===Resending cancellation to native screen canceled==="
SET_GCODE_VARIABLE MACRO=_CANCEL_PRINT VARIABLE=cancel_send VALUE=0
ZCONTROL_OFF
_SET_GCODE_OFFSET_FAST Z=0 FROM=CANCEL_PRINT
SET_GCODE_VARIABLE MACRO=_TEST_POINT VARIABLE=temp_z_offset VALUE=0.0
{% else %}
RUN_SHELL_COMMAND CMD=zsend PARAMS="M26"
_STOP
SET_GCODE_VARIABLE MACRO=_CANCEL_PRINT VARIABLE=cancel_send VALUE=1
RESPOND TYPE=echo MSG="===Cancellation sent to native screen==="
{% endif %}
{% set zclose_dialogs = printer.save_variables.variables['close_dialogs']|default(2) | int %}
{% if zclose_dialogs == 1 %}
UPDATE_DELAYED_GCODE ID=_CLOSE_DIALOGS DURATION=20
{% endif %}
{% if zclose_dialogs == 2 %}
UPDATE_DELAYED_GCODE ID=_FAST_CLOSE_DIALOGS DURATION=20
{% endif %}
{% set zstop_motor = printer.save_variables.variables['stop_motor']|default(1) | int %}
{% if zstop_motor == 1 %}
UPDATE_DELAYED_GCODE ID=_STOP_MOTOR DURATION=25
{% endif %}
CANCEL_PRINT_BASE
[gcode_macro _SCREEN]
variable_screen: True
gcode:
[gcode_macro _USER_START_PRINT]
gcode:
[gcode_macro START_PRINT]
description: ===Replace default start G-code===
variable_screen: True
gcode:
{% set extruder_temp = params.EXTRUDER_TEMP|default(245)|float %}
{% set bed_temp = params.BED_TEMP|default(80)|float %}
{% set force_kamp = params.FORCE_KAMP|default(False) %}
{% set force_leveling = params.FORCE_LEVELING|default(False) %}
{% set skip_leveling = params.SKIP_LEVELING|default(False) %}
{% set zoffset = params.Z_OFFSET|default(99.0)|float %}
{% set mesh = params.MESH|default("")|string %}
{% if params.FORCE_MD5 %}
{% set force_md5 = params.FORCE_MD5|default(True) %}
{% if force_md5 == True %}
{action_raise_error("===Parameter=== FORCE_MD5 ===moved to=== SAVE_ZMOD_DATA\n===Use=== SAVE_ZMOD_DATA FORCE_MD5=1")}
{% else %}
{action_raise_error("===Parameter=== FORCE_MD5 ===moved to=== SAVE_ZMOD_DATA\n===Use=== SAVE_ZMOD_DATA FORCE_MD5=0")}
{% endif %}
{% endif %}
{% if params.DISABLE_PRIMING %}
{% set disable_priming = params.DISABLE_PRIMING|default(False) %}
{% if disable_priming == True %}
{action_raise_error("===Parameter=== DISABLE_PRIMING ===moved to=== SAVE_ZMOD_DATA\n===Use=== SAVE_ZMOD_DATA DISABLE_PRIMING=1")}
{% else %}
{action_raise_error("===Parameter=== DISABLE_PRIMING ===moved to=== SAVE_ZMOD_DATA\n===Use=== SAVE_ZMOD_DATA DISABLE_PRIMING=0")}
{% endif %}
{% endif %}
{% if params.DISABLE_SKEW_CORRECT %}
{% set disable_skew = params.DISABLE_SKEW_CORRECT|default(True) %}
{% if disable_skew == True %}
{action_raise_error("===Parameter=== DISABLE_SKEW_CORRECT ===moved to=== SAVE_ZMOD_DATA\n===Use=== SAVE_ZMOD_DATA DISABLE_SKEW=1")}
{% else %}
{action_raise_error("===Parameter=== DISABLE_SKEW_CORRECT ===moved to=== SAVE_ZMOD_DATA\n===Use=== SAVE_ZMOD_DATA DISABLE_SKEW=0")}
{% endif %}
{% endif %}
{% if params.CLEAR %}
{% set clear = params.CLEAR|default("_CLEAR1")|string %}
{action_raise_error("===Parameter=== CLEAR ===moved to=== SAVE_ZMOD_DATA\n===Use=== SAVE_ZMOD_DATA CLEAR=" + clear)}
{% endif %}
SET_GCODE_VARIABLE MACRO=_START_PRINT VARIABLE=zforce_kamp VALUE={force_kamp|int}
SET_GCODE_VARIABLE MACRO=_START_PRINT VARIABLE=zbed_temp VALUE={bed_temp|float}
SET_GCODE_VARIABLE MACRO=_START_PRINT VARIABLE=zextruder_temp VALUE={extruder_temp|float}
SET_GCODE_VARIABLE MACRO=_START_PRINT VARIABLE=zforce_leveling VALUE={force_leveling}
SET_GCODE_VARIABLE MACRO=_START_PRINT VARIABLE=zforce_kamp VALUE={force_kamp}
SET_GCODE_VARIABLE MACRO=_START_PRINT VARIABLE=zskip_leveling VALUE={skip_leveling}
SET_GCODE_VARIABLE MACRO=_START_PRINT VARIABLE=zzoffset VALUE={zoffset|float}
SET_GCODE_VARIABLE MACRO=_START_PRINT VARIABLE=zmesh VALUE='"{mesh|string}"'
_START_PRINT
_USER_START_PRINT
[gcode_macro _USER_END_PRINT]
gcode:
[gcode_macro END_PRINT]
description: ===End G-code===
gcode:
_NOTIFY MSG="===The printer has finished printing the file===" TYPE=end
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
{% if (printer.toolhead.extruder != '') and (printer[printer.toolhead.extruder].can_extrude) %}
G1 E-3 F3600
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
{% if printer.gcode_move.gcode_position.x != client.custom_park_x %}
{% if printer.gcode_move.gcode_position.y > client.max_y %}
G1 Y{client.max_y} F12000
M400
{% endif %}
G1 X{client.custom_park_x} F12000
M400
{% endif %}
G1 Y{client.custom_park_y} F30000
M400
{% endif %}
{% set zclose_dialogs = printer.save_variables.variables['close_dialogs']|default(2) | int %}
{% if zclose_dialogs == 1 %}
UPDATE_DELAYED_GCODE ID=_CLOSE_DIALOGS DURATION=20
{% endif %}
{% if zclose_dialogs == 2 %}
UPDATE_DELAYED_GCODE ID=_FAST_CLOSE_DIALOGS DURATION=20
{% endif %}
{% set zauto_reboot = printer.save_variables.variables['auto_reboot']|default(0) | int %}
{% if zauto_reboot != 0 %}
RESPOND PREFIX="info" MSG="===Automatic reboot in 1.5 minutes==="
UPDATE_DELAYED_GCODE ID=_AUTO_REBOOT DURATION=90
{% endif %}
{% set pro_poweroff_timeout = printer.save_variables.variables['pro_poweroff_timeout']|default(0) | int %}
{% if pro_poweroff_timeout != 0 %}
RESPOND PREFIX="info" MSG="===Automatic printer shutdown in {pro_poweroff_timeout} min==="
UPDATE_DELAYED_GCODE ID=_PRO_POWEROFF DURATION={pro_poweroff_timeout*60}
{% endif %}
_STOP
_SET_GCODE_OFFSET_FAST Z=0 FROM=END_PRINT
SET_GCODE_VARIABLE MACRO=_TEST_POINT VARIABLE=temp_z_offset VALUE=0.0
{% set zstop_motor = printer.save_variables.variables['stop_motor']|default(1) | int %}
{% if zstop_motor == 1 %}
UPDATE_DELAYED_GCODE ID=_STOP_MOTOR DURATION=60
{% endif %}
_USER_END_PRINT
[gcode_macro _PRINT_FILE]
description: ===Print file===
gcode:
{% set path = printer.configfile.settings.virtual_sdcard.path %}
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
{% set silent = printer.save_variables.variables['silent']|default(0) | int %}
{% set zclear = printer.save_variables.variables['clear']|default("LINE_PURGE")|string %}
{% set leveling = printer.save_variables.variables['print_leveling']|default(0) | int %}
{% set zuse_kamp = printer.save_variables.variables['use_kamp']|default(0) | int %}
_PREPARE_PRINT
_SET_GCODE_OFFSET_FAST Z=0 FROM=_PRINT_FILE
SET_GCODE_VARIABLE MACRO=_TEST_POINT VARIABLE=temp_z_offset VALUE=0.0
G90
{% if 'FILENAME' in params %}
{% set filename = params.FILENAME|default("")|string %}
{% if leveling == 1 %}
RESPOND PREFIX="info" MSG="===Printing file {filename} with bed leveling from native screen==="
{% else %}
RESPOND PREFIX="info" MSG="===Printing file {filename} from native screen==="
{% endif %}
M23 /{filename}
{% else %}
{% if leveling == 1 %}
RESPOND PREFIX="info" MSG="===Printing file with bed leveling from native screen==="
{% else %}
RESPOND PREFIX="info" MSG="===Printing file from native screen==="
{% endif %}
{action_raise_error("===Error! Filename not specified.===")}
{% endif %}
EXCLUDE_OBJECT_DEFINE RESET=1
{% set force_md5 = printer.save_variables.variables['force_md5']|default(1) | int %}
{% if force_md5 == 1 %}
RESPOND PREFIX="info" MSG="===Started MD5 check {filename}==="
CHECK_MD5 DELETE=True FILENAME="{path}{filename}"
{% endif %}
{% if zuse_kamp == 1 and leveling == 1 %}
RESPOND PREFIX="info" MSG="===Getting data for KAMP.==="
ZEXCLUDE FILENAME="{filename}"
RUN_SHELL_COMMAND CMD=zexclude PARAMS={'"%s"' % (filename.replace("'", "\\\'").replace(" ", "\ "))}
{% endif %}
ZCONTROL_AUTO
ZCONTROL_ON
{% set zpreclear = printer.save_variables.variables['preclear']|default(0) | int %}
{% if zpreclear == 1 %}
RESPOND PREFIX="info" MSG="===Heating bed and extruder.==="
RESPOND PREFIX="//" MSG="===Printer screen will freeze until pre-cleaning is complete.==="
RUN_SHELL_COMMAND CMD=zpreclear PARAMS={'"%s TEST"' % (filename.replace("'", "\\\'").replace(" ", "\ "))}
{% else %}
RUN_SHELL_COMMAND CMD=zpreclear PARAMS={'"%s NONE"' % (filename.replace("'", "\\\'").replace(" ", "\ "))}
{% endif %}
{% if client.ad5x %}
SET_ZCOLOR FILENAME="{filename}" SILENT={silent} LEVELING={leveling}
{% else %}
{% if leveling == 1 %}
RUN_SHELL_COMMAND CMD=zprint PARAMS={'"PRINT %s"' % (filename.replace("'", "\\\'").replace(" ", "\ "))}
{% else %}
RUN_SHELL_COMMAND CMD=zsend PARAMS={'"M23 %s"' % (filename.replace("'", "\\\'").replace(" ", "\ "))}
{% endif %}
{% endif %}
[gcode_macro M26]
rename_existing: M26.1
gcode:
{% set zuse_kamp = printer.save_variables.variables['use_kamp']|default(0) | int %}
{% set zclear = printer.save_variables.variables['clear']|default("LINE_PURGE")|string %}
{% set filename = printer.virtual_sdcard.file_path|default("")|string %}
{% if zuse_kamp == 1 or zclear == "LINE_PURGE" %}
RESPOND PREFIX="info" MSG="===Getting data for KAMP.==="
RUN_SHELL_COMMAND CMD=zexclude PARAMS={'"%s"' % (filename.replace("'", "\\\'").replace(" ", "\ "))}
{% endif %}
M26.1 {rawparams}