forked from ghzserg/base
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.cfg
More file actions
2700 lines (2240 loc) · 100 KB
/
base.cfg
File metadata and controls
2700 lines (2240 loc) · 100 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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# (C) 2024-2026 ghzserg https://zmod.link/
[zmod]
[include ../mod_data/lang.cfg]
[gcode_macro _PREPARE_RESTORE]
gcode:
[gcode_macro _AFTER_RESTORE]
gcode:
[gcode_macro _GOTO_TRASH]
gcode:
[skew_correction]
[firmware_retraction]
retract_length: 0.7
retract_speed: 35
unretract_extra_length: 0
unretract_speed: 35
[include shell.cfg]
[gcode_macro CLEAR_NOZZLE]
description: ===Nozzle cleaning===
gcode:
{% set extruder_temp = params.EXTRUDER_TEMP|default(230)|float %}
{% set bed_temp = params.BED_TEMP|default(80)|float %}
{% set ignore_temp = params.IGNORE_TEMP|default(0)|int %}
{% set preclear = params.PRECLEAR|default(0)|int %}
_ORIG_CLEAR_NOZZLE EXTRUDER_TEMP={extruder_temp} BED_TEMP={bed_temp} IGNORE_TEMP={ignore_temp} PRECLEAR={preclear}
ZCONTROL_OFF
[include ff5.cfg]
[gcode_macro _TEST_MIN_MAX]
gcode:
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
{% if "xyz" in printer.toolhead.homed_axes %}
M400
SAVE_GCODE_STATE NAME=test_min_max
G90
{% if printer.gcode_move.gcode_position.y < client.min_y %}
G1 Y{client.min_y} F2000
M400
{% endif %}
{% if printer.gcode_move.gcode_position.y > client.max_y %}
G1 Y{client.max_y} F2000
M400
{% endif %}
{% if printer.gcode_move.gcode_position.x < client.min_x %}
G1 X{client.min_x} F2000
M400
{% endif %}
{% if printer.gcode_move.gcode_position.x > client.max_x %}
G1 X{client.max_x} F2000
M400
{% endif %}
RESTORE_GCODE_STATE MOVE=0 NAME=test_min_max
{% endif %}
[gcode_macro BED_MESH_CALIBRATE]
rename_existing: _BED_MESH_CALIBRATE
gcode:
{% set zuse_kamp = printer.save_variables.variables['use_kamp']|default(0) | int %}
SET_GCODE_VARIABLE MACRO=_TEST_POINT VARIABLE=temp_z_offset VALUE=0.0
{% if zuse_kamp == 1 %}
RESPOND PREFIX="info" MSG="===Using KAMP==="
M400
_KAMP_BED_MESH_CALIBRATE
M400
{% else %}
RESPOND PREFIX="info" MSG="===Using BED_MESH_CALIBRATE==="
_TEST_MIN_MAX
M400
_BED_MESH_CALIBRATE {rawparams}
M400
{% endif %}
[gcode_macro _G28]
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
_HOME
{% endif %}
[gcode_macro CHECK_MD5]
description: ===File MD5 sum check===
gcode:
{% if 'FILENAME' in params %}
{% set filename = params.FILENAME|default("")|string %}
{% else %}
{% set filename = printer.virtual_sdcard.file_path|default("")|string %}
{% endif %}
SAVE_VARIABLE VARIABLE=check_md5 VALUE={0|int}
{% if filename != "" %}
{% if 'DELETE' in params %}
{% set delete = params.DELETE|default("False")|string %}
{% endif %}
RUN_SHELL_COMMAND CMD=check_md5 PARAMS={'"%s %s"' % (filename.replace("'", "\\\'").replace(" ", "\ "), delete)}
{% for i in range(30) %}
ZLOAD_VARIABLE
_CHECK_MD5
{% endfor %}
ZLOAD_VARIABLE
_FINAL_CHECK_MD5 FILENAME="{filename}"
{% endif %}
[gcode_macro _CHECK_START_PRINT]
gcode:
{% set filename = params.FILENAME|default("")|string %}
RUN_SHELL_COMMAND CMD=check_start_print PARAMS={'"%s %s"' % (filename.replace("'", "\\\'").replace(" ", "\ "), delete)}
[gcode_macro _CHECK_MD5]
description: ===Waiting for check to complete===
gcode:
{% set check_md5 = printer.save_variables.variables['check_md5']|default(0) | int %}
{% if (check_md5 == 0) %}
G4 P{1000}
{% endif %}
[gcode_macro _FINAL_CHECK_MD5]
description: ===Final test===
gcode:
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
{% set filename = params.FILENAME|default("")|string %}
{% set check_md5 = printer.save_variables.variables['check_md5']|default(0) | int %}
{% if (check_md5 == 0) %}
RESPOND TYPE=error MSG="===Error: File '{filename}' was not verified in time. Print canceled.==="
CANCEL_PRINT
_FINAL_STOP_MD5
{% endif %}
{% if (check_md5 == 1) %}
RESPOND TYPE=error MSG="===Error: File '{filename}' not specified. Print canceled.==="
CANCEL_PRINT
_FINAL_STOP_MD5
{% endif %}
{% if (check_md5 == 2) %}
RESPOND TYPE="error" MSG="===Error: File {filename} not found. Print canceled.==="
CANCEL_PRINT
_FINAL_STOP_MD5
{% endif %}
{% if (check_md5 == 3) %}
RESPOND TYPE="error" MSG="===File {filename} has no MD5 checksum. Enable it in Orca. https://wiki.zmod.link/Recomendations/==="
{% endif %}
{% if (check_md5 == 4) %}
{% if not client.ad5x %}
RESPOND TYPE="error" MSG="===File {filename} contains arc commands (G2, G3). Disable them. In Orca: Process Profile -> Arc Approximation -> Uncheck=== ===Replace Spiral/Auto Z-Hop. In Orca: Printer Profile -> Extruder 1 -> Z Hop Type -> Set to Normal or Sloped==="
{% endif %}
RESPOND PREFIX="info" MSG="===File {filename} verified successfully. MD5 checksum matches.==="
{% endif %}
{% if (check_md5 == 8) %}
{% if not client.ad5x %}
RESPOND TYPE="error" MSG="===File {filename} uses unsupported G17/G18/G19 commands. Replace Z-Hop type.=== ===In Orca: Printer Profile -> Extruder 1 -> Z Hop Type -> Set to Normal or Sloped==="
{% endif %}
RESPOND PREFIX="info" MSG="===File {filename} verified successfully. MD5 checksum matches.==="
{% endif %}
{% if (check_md5 == 5) %}
RESPOND PREFIX="info" MSG="===File {filename} verified successfully. MD5 checksum matches.==="
{% endif %}
{% if (check_md5 == 6) %}
RESPOND TYPE="error" MSG="===File {filename} MD5 mismatch. File deleted. Print canceled==="
CANCEL_PRINT
_FINAL_STOP_MD5
{% endif %}
{% if (check_md5 == 7) %}
RESPOND TYPE="error" MSG="===File {filename} MD5 mismatch. Print canceled==="
CANCEL_PRINT
_FINAL_STOP_MD5
{% endif %}
[gcode_macro _FINAL_STOP_MD5]
gcode:
{action_raise_error("===MD5 check failed. Print canceled.===")}
[gcode_macro BED_LEVEL_SCREWS_TUNE]
description: ===Bed screw calibration===
gcode:
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
{% set extruder_temp = params.EXTRUDER_TEMP|default(130)|float %}
{% set bed_temp = params.BED_TEMP|default(80)|float %}
RESPOND PREFIX="info" MSG="===Before measurements, don't forget to clean the nozzle with CLEAR_NOZZLE macro==="
BED_MESH_CLEAR
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={extruder_temp}
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={bed_temp}
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={bed_temp-2} MAXIMUM={bed_temp+3}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={extruder_temp-2} MAXIMUM={extruder_temp+3}
_HOME
_GOTO_MID
LOAD_CELL_TARE
SCREWS_TILT_CALCULATE
{% if client.ad5x %}
G1 X110 Y110 F3000
{% else %}
G1 X0 Y0 F3000
{% endif %}
[gcode_macro _GOTO_MESH]
gcode:
#G1 Z100 F600
#M400
_GOTO_MID
[gcode_macro _FIX_BED_MESH_CALIBRATE]
gcode:
{% set profile = params.PROFILE|default("default") %}
RESPOND PREFIX="info" MSG="===Before measurements, don't forget to clean the nozzle with CLEAR_NOZZLE macro==="
_G28
_GOTO_MID
LOAD_CELL_TARE
_BED_MESH_CALIBRATE PROFILE="{profile}"
_GOTO_MESH
[gcode_macro _FULL_BED_LEVEL]
description: ===Bed calibration without temperature off===
gcode:
{% set extruder_temp = params.EXTRUDER_TEMP|default(240)|float %}
{% set bed_temp = params.BED_TEMP|default(80)|float %}
{% set profile = params.PROFILE|default("auto") %}
RESPOND PREFIX="info" MSG="===Bed calibration. Profile {profile}. Extruder temp: {extruder_temp} / Bed temp: {bed_temp}==="
BED_MESH_CLEAR ; Очистка профиля стола
M400
_ORIG_CLEAR_NOZZLE EXTRUDER_TEMP={extruder_temp} BED_TEMP={bed_temp}
# Начинаем калибровку
_BED_MESH_CALIBRATE PROFILE="{profile}"
_UGOL_PARK
[gcode_macro AUTO_FULL_BED_LEVEL]
description: ===Bed calibration with temperature off===
gcode:
{% set extruder_temp = params.EXTRUDER_TEMP|default(240)|float %}
{% set bed_temp = params.BED_TEMP|default(80)|float %}
{% set profile = params.PROFILE|default("auto") %}
_FULL_BED_LEVEL EXTRUDER_TEMP={extruder_temp} BED_TEMP={bed_temp} PROFILE={profile}
# Выклчюаем обогрев
_STOP
[include ./KAMP/KAMP_Settings.cfg]
[gcode_macro _WAIT_TEMP]
# Убираем стабилизацию температуры, для тех у кого не настроен PID экструдера и/или PID стола
gcode:
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
{% set extruder_temp = params.EXTRUDER_TEMP|default(240)|float %}
{% set bed_temp = params.BED_TEMP|default(80)|float %}
{% set name = params.NAME|default("") %}
RESPOND PREFIX="//" MSG="===Waiting for temperature normalization. Bed: {bed_temp-3}-{bed_temp+4}. Extruder: {extruder_temp-2}-{extruder_temp+4}=== {name}"
RESPOND PREFIX="//" MSG="===If it takes a long time, calibrate the PID of the extruder and bed=== {name}"
{% if bed_temp | int != 0 %}
M140 S{bed_temp}
{% endif %}
# Включаем для AD5X одновременный нагрев сопла и стола
{% if client.ad5x %}
{% if bed_temp | int != 0 %}
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={bed_temp-20} MAXIMUM={bed_temp+4}
{% endif %}
{% if extruder_temp | int != 0 %}
M104 S{extruder_temp}
{% endif %}
{% endif %}
{% if bed_temp | int != 0 %}
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={bed_temp-3} MAXIMUM={bed_temp+4}
{% endif %}
{% if extruder_temp | int != 0 %}
M104 S{extruder_temp}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={extruder_temp-2} MAXIMUM={extruder_temp+4}
{% endif %}
RESPOND PREFIX="//" MSG="===Temperature normalization completed=== {name}"
[gcode_macro KAMP]
description: ===Adaptive bed===
gcode:
{% set extruder_temp = params.EXTRUDER_TEMP|default(240)|float %}
{% set bed_temp = params.BED_TEMP|default(80)|float %}
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
BED_MESH_CLEAR ; Очистка профиля стола
M400
_ORIG_CLEAR_NOZZLE EXTRUDER_TEMP={extruder_temp} BED_TEMP={bed_temp}
M400
_KAMP_BED_MESH_CALIBRATE
M400
_SMART_PARK
M400
_WAIT_TEMP EXTRUDER_TEMP={extruder_temp} BED_TEMP={bed_temp} NAME=KAMP
# Калибровка PID стола
[gcode_macro PID_TUNE_BED]
description: ===Bed PID calibration===
gcode:
{% set temperature = params.TEMPERATURE|default(80) %}
_HOME
_GOTO_MID
M107
PID_CALIBRATE HEATER=heater_bed TARGET={temperature}
_SAVE_CONFIG
# Калибровка PID экструдера
[gcode_macro PID_TUNE_EXTRUDER]
description: ===Extruder PID calibration===
gcode:
{% set temperature = params.TEMPERATURE|default(245) | int %}
{% set cooler = params.COOLER|default(100) | int %}
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
_HOME
_GOTO_MID
G1 X{client.min_x+(client.max_x-client.min_x)/2} Y{client.min_y+(client.max_y-client.min_y)/2} F3000
M106 P0 S{2.55*cooler| float}
PID_CALIBRATE HEATER=extruder TARGET={temperature}
_SAVE_CONFIG
[gcode_macro LOAD_FILAMENT]
variable_load_distance: 125
gcode:
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity * 60 %}
{% set m600_temp = printer["gcode_macro M600"].zextruder_temp|float %}
{% set extruder_temp = params.EXTRUDER_TEMP|default(m600_temp) | float %}
{% set extrude_len = params.EXTRUDE_LEN|default(load_distance) |float %}
{% set speed = params.SPEED|default(450)|float %}
RESPOND PREFIX="info" MSG="===Loading filament at {extruder_temp} for {extrude_len}mm at {speed/60} mm/s==="
M104 S{extruder_temp}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={extruder_temp-1}
M400
SAVE_GCODE_STATE NAME=load_state
G91
G92 E0
_DISABLE_SENSOR
G1 E{extrude_len} F{speed} ; extrude with 7.5mm/s
M400
_ENABLE_SENSOR
RESTORE_GCODE_STATE MOVE=0 NAME=load_state
[gcode_macro UNLOAD_FILAMENT]
variable_unload_distance: 75
gcode:
{% set speed = params.SPEED|default(450)|int %}
{% set extruder_temp = printer["gcode_macro M600"].zextruder_temp|float %}
M104 S{extruder_temp}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={extruder_temp}
M400
SAVE_GCODE_STATE NAME=unload_state
G91
G92 E0
_DISABLE_SENSOR
G1 E-{unload_distance} F{speed} ; unload
M400
_ENABLE_SENSOR
RESTORE_GCODE_STATE MOVE=0 NAME=unload_state
[gcode_macro PURGE_FILAMENT]
variable_purge_distance: 25
gcode:
{% set speed = params.SPEED|default(450)|int %}
{% set extruder_temp = printer["gcode_macro M600"].zextruder_temp|float %}
M104 S{extruder_temp}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={extruder_temp}
M400
SAVE_GCODE_STATE NAME=purge_state
G91
G92 E0
_DISABLE_SENSOR
G1 E{purge_distance} F{speed} ; purge
M400
_ENABLE_SENSOR
RESTORE_GCODE_STATE MOVE=0 NAME=purge_state
[gcode_macro LOAD_MATERIAL]
description: ===Manual filament loading / change===
variable_initial_target_temp: 0
gcode:
# save gcode state
M400
SAVE_GCODE_STATE NAME=load_material_state
# save heating state
SET_GCODE_VARIABLE MACRO=LOAD_MATERIAL VARIABLE=initial_target_temp VALUE={printer["extruder"].target}
_LOAD_MATERIAL_SELECT
[gcode_macro _LOAD_MATERIAL_SELECT]
gcode:
{% if not printer["extruder"].target >= printer.configfile.settings['extruder'].min_extrude_temp %}
RESPOND TYPE=command MSG="action:prompt_begin ===Material selection==="
RESPOND TYPE=command MSG="action:prompt_text ===Select material to load==="
RESPOND TYPE=command MSG="action:prompt_button_group_start"
RESPOND TYPE=command MSG="action:prompt_button PLA|_LOAD_MATERIAL_HEATUP TEMP=210|primary"
RESPOND TYPE=command MSG="action:prompt_button PETG|_LOAD_MATERIAL_HEATUP TEMP=240|primary"
RESPOND TYPE=command MSG="action:prompt_button ABS|_LOAD_MATERIAL_HEATUP TEMP=250|primary"
RESPOND TYPE=command MSG="action:prompt_button_group_end"
RESPOND TYPE=command MSG="action:prompt_footer_button ===Cancel===|_LOAD_MATERIAL_END"
RESPOND TYPE=command MSG="action:prompt_show"
{% else %}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={printer["extruder"].target}
_LOAD_MATERIAL_ACTION
{% endif %}
[gcode_macro _LOAD_MATERIAL_HEATUP]
gcode:
{% set extruder_temp = params.TEMP|default(200)|float %}
M104 S{extruder_temp}
RESPOND TYPE=command MSG=action:prompt_end
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={extruder_temp}
_LOAD_MATERIAL_ACTION
[gcode_macro _LOAD_MATERIAL_ACTION]
gcode:
RESPOND TYPE=command MSG="action:prompt_begin ===Filament management==="
RESPOND TYPE=command MSG="action:prompt_text ===Select action==="
RESPOND TYPE=command MSG="action:prompt_button_group_start"
RESPOND TYPE=command MSG="action:prompt_button ===Load===|LOAD_FILAMENT|primary"
RESPOND TYPE=command MSG="action:prompt_button ===Unload===|UNLOAD_FILAMENT|primary"
RESPOND TYPE=command MSG="action:prompt_button ===Purge===|PURGE_FILAMENT|primary"
RESPOND TYPE=command MSG="action:prompt_button_group_end"
RESPOND TYPE=command MSG="action:prompt_footer_button ===OK===|_LOAD_MATERIAL_END"
RESPOND TYPE=command MSG="action:prompt_show"
[gcode_macro _LOAD_MATERIAL_END]
gcode:
RESPOND TYPE=command MSG="action:prompt_end"
# restore old temp
M104 S{printer["gcode_macro LOAD_MATERIAL"].initial_target_temp}
# restore gcode state
RESTORE_GCODE_STATE MOVE=0 NAME=load_material_state
[gcode_macro M600]
description: ===Pause and filament change===
variable_zextruder_temp: 240.0
gcode:
{% set extruder_temp = printer[printer.toolhead.extruder].target if printer.toolhead.extruder != '' else 240.0 %}
SET_GCODE_VARIABLE MACRO=M600 VARIABLE=zextruder_temp VALUE={extruder_temp|float}
RESPOND PREFIX="info" MSG="===Nozzle temperature {extruder_temp}==="
PAUSE
RESPOND TYPE=command MSG="action:prompt_begin ===Filament Change==="
RESPOND TYPE=command MSG="action:prompt_text ===Filament change requested. Load new filament and click 'Resume'.==="
RESPOND TYPE=command MSG="action:prompt_button_group_start"
RESPOND TYPE=command MSG="action:prompt_button ===Load===|LOAD_FILAMENT|primary"
RESPOND TYPE=command MSG="action:prompt_button ===Unload===|UNLOAD_FILAMENT|primary"
RESPOND TYPE=command MSG="action:prompt_button ===Purge===|PURGE_FILAMENT|primary"
RESPOND TYPE=command MSG="action:prompt_button_group_end"
RESPOND TYPE=command MSG="action:prompt_footer_button ===Resume===|_INTERACTIVE_LOAD_END"
RESPOND TYPE=command MSG="action:prompt_show"
[gcode_macro _INTERACTIVE_LOAD_END]
gcode:
RESPOND TYPE=command MSG="action:prompt_end"
RESUME
[gcode_macro _SHUTDOWN]
variable_trigger_allowed: False
gcode:
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
{% if trigger_allowed %}
{% if not client.ad5x %}
SET_PIN PIN=clear_power_off VALUE=1
G4 P500
SET_PIN PIN=clear_power_off VALUE=0
{% endif %}
RESPOND TYPE=command MSG="action:prompt_begin ===Shutdown printer?==="
RESPOND TYPE=command MSG="action:prompt_text ===Shutdown printer?==="
RESPOND TYPE=command MSG="action:prompt_button_group_start"
RESPOND TYPE=command MSG="action:prompt_button ===Yes===|SHUTDOWN|primary"
RESPOND TYPE=command MSG="action:prompt_button_group_end"
RESPOND TYPE=command MSG="action:prompt_footer_button ===Cancel===|RESPOND TYPE=command MSG=action:prompt_end"
RESPOND TYPE=command MSG="action:prompt_show"
{% endif %}
[gcode_macro SHUTDOWN]
description: ===Power off printer===
gcode:
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
RESPOND TYPE=command MSG="action:prompt_end"
BED_MESH_CLEAR
M400
{% if not client.ad5x %}
# Reset button state, otherwise only one trigger can occur
SET_PIN PIN=clear_power_off VALUE=1
# There is a deboucing circuit which needs some delay
G4 P500
# Disable pin again otherwise on reset the button will be triggered 1-3 times
SET_PIN PIN=clear_power_off VALUE=0
{% endif %}
RUN_SHELL_COMMAND CMD=run_power_off
RUN_SHELL_COMMAND CMD=sync
G4 P1000
RUN_SHELL_COMMAND CMD=sync
G4 P1000
{% if not client.ad5x %}
SET_PIN PIN=power_off VALUE=0
{% endif %}
G4 P1000
RUN_SHELL_COMMAND CMD=poweroff
[gcode_macro _REBOOT]
gcode:
RESPOND TYPE=command MSG="action:prompt_begin ===There will be a SCHEDULED reboot now==="
RESPOND TYPE=command MSG="action:prompt_text ===There will be a SCHEDULED reboot now==="
RESPOND TYPE=command MSG="action:prompt_footer_button OK|RESPOND TYPE=command MSG=action:prompt_end|info"
RESPOND TYPE=command MSG="action:prompt_show"
G4 P3000
[gcode_macro REBOOT]
description: ===Reboot printer===
gcode:
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
BED_MESH_CLEAR
M400
RUN_SHELL_COMMAND CMD=sync
G4 P1000
_REBOOT
RUN_SHELL_COMMAND CMD=sync
{% if not client.ad5x %}
# Reset button state, otherwise only one trigger can occur
SET_PIN PIN=clear_power_off VALUE=1
# There is a deboucing circuit which needs some delay
G4 P500
# Disable pin again otherwise on reset the button will be triggered 1-3 times
SET_PIN PIN=clear_power_off VALUE=0
{% endif %}
RUN_SHELL_COMMAND CMD=sync
G4 P1000
RUN_SHELL_COMMAND CMD=reboot
[gcode_macro REMOVE_ZMOD]
description: ===Remove zmod===
gcode:
{% set full = params.FULL|default(0)|int %}
CLEAR_EMMC
{% if full == 1 %}
RUN_SHELL_COMMAND CMD=ztouch PARAMS="/opt/config/mod/FULL_REMOVE"
{% else %}
RUN_SHELL_COMMAND CMD=ztouch PARAMS="/opt/config/mod/REMOVE"
{% endif %}
RUN_SHELL_COMMAND CMD=sync
_REBOOT
RUN_SHELL_COMMAND CMD=reboot
[gcode_macro SKIP_ZMOD]
description: ===Reboot to original system (no zmod)===
gcode:
{% set mute = params.MUTE|default(0)|int %}
{% if mute == 0 %}
RESPOND TYPE=command MSG="action:prompt_begin ===Temporary Z-Mod disable==="
RESPOND TYPE=command MSG="action:prompt_text ===After clicking OK the printer will be powered off==="
RESPOND TYPE=command MSG="action:prompt_text ===You need to disconnect power cord and then reconnect it==="
RESPOND TYPE=command MSG="action:prompt_text ===Printer will boot into stock firmware==="
RESPOND TYPE=command MSG="action:prompt_footer_button ===OK===|SKIP_ZMOD MUTE=1"
RESPOND TYPE=command MSG="action:prompt_show"
{% else %}
RESPOND TYPE=command MSG="action:prompt_end"
RUN_SHELL_COMMAND CMD=ztouch PARAMS="/opt/config/mod/SKIP_ZMOD"
RUN_SHELL_COMMAND CMD=sync
RUN_SHELL_COMMAND CMD=poweroff
{% endif %}
[gcode_macro LED_ON]
description: ===Enable backlight===
gcode:
SET_LED LED=chamber_led WHITE=1
[gcode_macro LED_OFF]
description: ===Disable backlight===
gcode:
SET_LED LED=chamber_led WHITE=0
[gcode_macro LED]
description: ===Enable backlight===
gcode:
{% set S = params.S|default(50)|int %}
SET_LED LED=chamber_led WHITE={S/100|float}
[gcode_macro DISPLAY_ON]
description: ===Enable stock screen and reboot===
gcode:
SAVE_VARIABLE VARIABLE=display_off VALUE=0
RUN_SHELL_COMMAND CMD=zdisplay PARAMS="on"
[gcode_macro DISPLAY_OFF]
description: ===Disable stock screen===
gcode:
{% set guppy = params.GUPPY|default(1)|int %}
{% set helix = params.HELIX|default(0)|int %}
{% set load_zoffset = printer.save_variables.variables['load_zoffset']|default(1) | int %}
SAVE_VARIABLE VARIABLE=display_off VALUE=1
RESPOND TYPE=command MSG="action:prompt_begin Warning"
RESPOND TYPE=command MSG="action:prompt_text ===Do not disable display if you don't fully understand bed leveling, Z-Offset and START_PRINT/END_PRINT macros==="
RESPOND TYPE=command MSG="action:prompt_text ===Use LOAD_ZOFFSET_NATIVE to copy the Z-Offset from the native screen.==="
RESPOND TYPE=command MSG="action:prompt_text ===Turn on NOZZLE_CONTROL to control the nozzle impact on the table==="
RESPOND TYPE=command MSG="action:prompt_text ===https://wiki.zmod.link/FAQ/==="
{% if guppy == 1 or helix == 1 %}
{% if helix == 1 %}
RESPOND PREFIX="info" MSG="===Loading HelixScreen==="
SAVE_VARIABLE VARIABLE=helix VALUE={1|int}
SAVE_VARIABLE VARIABLE=guppy VALUE={0|int}
{% else %}
RESPOND PREFIX="info" MSG="===Loading GuppyScreen==="
SAVE_VARIABLE VARIABLE=guppy VALUE={1|int}
SAVE_VARIABLE VARIABLE=helix VALUE={0|int}
{% endif %}
{% if load_zoffset == 0 %}
RESPOND PREFIX="info" MSG="===Use Z-Offset loading from global parameters to control Z-Offset with Alter Screen==="
RESPOND PREFIX="info" MSG="SAVE_ZMOD_DATA LOAD_ZOFFSET=1"
{% endif %}
RESPOND TYPE=command MSG="action:prompt_footer_button Ok|RESPOND TYPE=command MSG=action:prompt_end|info"
RESPOND TYPE=command MSG="action:prompt_show"
G4 P5000
RUN_SHELL_COMMAND CMD=zdisplay PARAMS="guppy"
{% else %}
RESPOND TYPE=command MSG="action:prompt_footer_button Ok|RESPOND TYPE=command MSG=action:prompt_end|info"
RESPOND TYPE=command MSG="action:prompt_show"
G4 P5000
RUN_SHELL_COMMAND CMD=zdisplay PARAMS="off"
SAVE_VARIABLE VARIABLE=guppy VALUE={0|int}
SAVE_VARIABLE VARIABLE=helix VALUE={0|int}
{% endif %}
RESTART
[gcode_macro MEM]
description: ===Check memory usage===
gcode:
RUN_SHELL_COMMAND CMD=zmem
[gcode_macro PLAY_MIDI]
description: ===Play MIDI file===
variable_mute: 0
gcode:
{% if mute == 0 %}
{% set FILE = params.FILE|default("For_Elise.mid")|string %}
RUN_SHELL_COMMAND CMD=audio_midi PARAMS="{FILE}"
{% endif %}
[gcode_macro MUTE]
description: ===Mute sound===
gcode:
{% set mute = params.MUTE|default(1)|int %}
SET_GCODE_VARIABLE MACRO=PLAY_MIDI VARIABLE=mute VALUE={mute}
[gcode_macro CAMERA_ON]
description: ===Use alternative camera===
gcode:
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
{% if not client.ad5x %}
{% set WIDTH = params.WIDTH|default(640)|int %}
{% set HEIGHT = params.HEIGHT|default(480)|int %}
{% else %}
{% set WIDTH = params.WIDTH|default(1280)|int %}
{% set HEIGHT = params.HEIGHT|default(720)|int %}
{% endif %}
{% set FPS = params.FPS|default(20)|int %}
{% set VIDEO = params.VIDEO|default(client.video)|string %}
{% set FS = params.FS|default(0)|int %}
{% set STREAMER = params.STREAMER|default("auto")|string %}
{% set FORMAT = params.FORMAT|default("MJPEG")|string %}
RESPOND PREFIX="info" MSG="===Don't forget to turn off the camera on your printer's native screen.==="
RUN_SHELL_COMMAND CMD=zcamera PARAMS="on {WIDTH} {HEIGHT} {FPS} {VIDEO} {FS} {STREAMER} {FORMAT} RESTART"
RUN_SHELL_COMMAND CMD=cat PARAMS="/opt/config/mod_data/log/cam/cam.log"
[gcode_macro CAMERA_OFF]
description: ===Disable alternative camera===
gcode:
RESPOND PREFIX="info" MSG="===Enable camera on printer screen==="
RUN_SHELL_COMMAND CMD=zcamera PARAMS="off"
[gcode_macro CAMERA_RESTART]
description: ===Restart alternative camera===
gcode:
RUN_SHELL_COMMAND CMD="s99camera" PARAMS="restart"
[gcode_macro DATE_GET]
description: ===Check time===
gcode:
RUN_SHELL_COMMAND CMD=date
[gcode_macro DATE_SET]
description: ===Set date and time (format: 2024.01.01-00:00:00)===
gcode:
{% set dt = params.DT|default("2024.01.01-00:00:00")|string %}
RUN_SHELL_COMMAND CMD=zremote PARAMS="/bin/date {dt}"
[gcode_macro WEB]
description: ===Switch web interface (fluidd/mainsail)===
gcode:
{% set mute = params.MUTE|default(0)|int %}
{% if mute == 0 %}
RESPOND TYPE=command MSG="action:prompt_begin ===After macro execution press Ctrl + F5==="
RESPOND TYPE=command MSG="action:prompt_text ===After macro execution press Ctrl + F5==="
RESPOND TYPE=command MSG="action:prompt_footer_button OK|WEB MUTE=1"
RESPOND TYPE=command MSG="action:prompt_show"
{% else %}
RESPOND TYPE=command MSG="action:prompt_end"
RUN_SHELL_COMMAND CMD=zhttp
{% endif %}
[gcode_macro _STOP_FAN]
gcode:
M106 S0 ; Отключить кулер
M107 ; Отключить кулер экструдера
SET_FAN_SPEED FAN=chamber_fan SPEED=0
[gcode_macro _STOP]
description: ===Disable heating and cooler===
gcode:
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
{% set screen = printer["gcode_macro _SCREEN"].screen %}
M400
M220 S100 ; Скорость 100%
M221 S100 ; Экструзия 100%
M140 S0 ; Отключить нагрев стола
M104 S0 ; Отключить нагрев экструдера
SET_SKEW CLEAR=1 ; reset skew profile if loaded
{% set zmidi_end = printer.save_variables.variables['midi_end']|default("") | string %}
{% if zmidi_end != "" %}
PLAY_MIDI FILE={zmidi_end}
{% endif %}
EXCLUDE_OBJECT_DEFINE RESET=1
SAVE_VARIABLE VARIABLE=check_md5 VALUE={0|int}
RUN_SHELL_COMMAND CMD=znice
{% if printer.bed_mesh.profile_name == "default" %}
BED_MESH_CLEAR
BED_MESH_PROFILE REMOVE=default
{% endif %}
ZCONTROL_OFF
{% if client.ad5x %}
{% if screen == False %}
IFS_F18
_MODIFY_END_CHANGE_FILAMENT_DATA RESET=1
{% endif %}
SDCARD_ENABLE_FFM ENABLE=0
{% endif %}
_STOP_FAN
_RESET_SPEED
UPDATE_DELAYED_GCODE ID=_ZUPDATE DURATION=20
RESPOND PREFIX="info" MSG="===Work completed==="
[gcode_macro CHECK_SYSTEM]
description: ===OS check===
gcode:
{% set restore = params.RESTORE|default(0)|int %}
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
{% set zklipper13 = printer.save_variables.variables['klipper13']|default(0) | int %}
{% if client.ad5x %}
{% if restore == 1 %}
RUN_SHELL_COMMAND CMD=zcheckmd5 PARAMS="restore 0"
{% else %}
RUN_SHELL_COMMAND CMD=zcheckmd5 PARAMS="not_restore 0"
{% endif %}
{% else %}
{% if restore == 1 %}
RUN_SHELL_COMMAND CMD=zcheckmd5 PARAMS="restore {zklipper13}"
{% else %}
RUN_SHELL_COMMAND CMD=zcheckmd5 PARAMS="not_restore {zklipper13}"
{% endif %}
{% endif %}
[gcode_macro SET_TIMEZONE]
description: ===Timezone change===
gcode:
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
{% set ZONE = params.ZONE|default("NONE")|string %}
{% if ZONE == "NONE" %}
RESPOND PREFIX="info" MSG="Europe/"
{% if not client.ad5x %}
RUN_SHELL_COMMAND CMD=ls PARAMS="/usr/share/zoneinfo/Europe"
{% else %}
RUN_SHELL_COMMAND CMD=ls PARAMS="/usr/data/.mod/.zmod/usr/share/zoneinfo/Europe"
{% endif %}
RESPOND PREFIX="info" MSG="Asia/"
{% if not client.ad5x %}
RUN_SHELL_COMMAND CMD=ls PARAMS="/usr/share/zoneinfo/Asia"
{% else %}
RUN_SHELL_COMMAND CMD=ls PARAMS="/usr/data/.mod/.zmod/usr/share/zoneinfo/Asia"
{% endif %}
RESPOND PREFIX="info" MSG="Use SET_TIMEZONE ZONE=Asia/Yekaterinburg"
{% else %}
RUN_SHELL_COMMAND CMD=rm PARAMS="/etc/localtime"
{% if not client.ad5x %}
RUN_SHELL_COMMAND CMD=ln PARAMS="-s /usr/share/zoneinfo/{ZONE} /etc/localtime"
{% else %}
RUN_SHELL_COMMAND CMD=ln PARAMS="-s /usr/data/.mod/.zmod/usr/share/zoneinfo/{ZONE} /etc/localtime"
RUN_SHELL_COMMAND CMD=rm PARAMS="/usr/data/.mod/.zmod/etc/localtime"
RUN_SHELL_COMMAND CMD=ln PARAMS="-s /usr/share/zoneinfo/{ZONE} /usr/data/.mod/.zmod/etc/localtime"
{% endif %}
{% endif %}
RUN_SHELL_COMMAND CMD=date
[gcode_macro STOP_ZMOD]
description: ===Stop fluidd/mainsail and moonraker===
gcode:
{% set screen = params.SCREEN|default(1)|int %}
{% set moonraker = params.MOONRAKER|default(1)|int %}
{% set http = params.HTTP|default(1)|int %}
RUN_SHELL_COMMAND CMD=stop_zmod PARAMS="stop {screen} {moonraker} {http}"
[gcode_macro START_ZMOD]
description: ===Start fluidd/mainsail and moonraker after STOP_ZMOD===
gcode:
{% set screen = params.SCREEN|default(1)|int %}
{% set moonraker = params.MOONRAKER|default(1)|int %}
{% set http = params.HTTP|default(1)|int %}
RUN_SHELL_COMMAND CMD=stop_zmod PARAMS="up {screen} {moonraker} {http}"
[gcode_macro TEST_EMMC]
description: ===Test EMMC===
gcode:
{% set size = params.SIZE|default(400)|int %}
{% set sync = params.SYNC|default(1)|int %}
{% set flash = params.FLASH|default(0)|int %}
{% set random = params.RANDOM|default(0)|int %}
RUN_SHELL_COMMAND CMD=zfs PARAMS="{size} {sync} {flash} {random}"
[gcode_macro CLEAR_EMMC]
description: ===Clear EMMC===
gcode:
{% set log = params.LOG|default(1)|int %}
{% set any = params.ANY|default(0)|int %}
RUN_SHELL_COMMAND CMD=clear_emmc PARAMS="{log} {any}"
[gcode_macro ZSSH_ON]
description: ===Redirect moonraker and camera to SSH server===
gcode:
{% set ssh_server = params.SSH_SERVER|default("127.0.0.1")|string %}
{% set ssh_port = params.SSH_PORT|default(22)|int %}
{% set ssh_user = params.SSH_USER|default("user")|string %}
{% set video_port = params.VIDEO_PORT|default(8080)|int %}
{% set moon_port = params.MOON_PORT|default(7125)|int %}
{% set remote_run = params.REMOTE_RUN|default("NONE")|string %}
RUN_SHELL_COMMAND CMD=zssh PARAMS="START {ssh_server} {ssh_port} {ssh_user} {video_port} {moon_port} '{remote_run}' RESTART"
[gcode_macro ZLINK]
description: zmod.link
gcode:
{% set p = params.P|default("bad")|string %}
{% set u = params.U|default("bad")|string %}
{% set m = params.M|default(0)|int %}
{% set c = params.C|default(0)|int %}
{% if p == "" or u == "" or m == 0 or c ==0 %}
RESPOND TYPE="echo" MSG="===Incorrect ZLINK data. Register your printer on the http://zmod.link and receive a ZLINK string.==="
RUN_SHELL_COMMAND CMD=zlink PARAMS="get"
{% else %}
RUN_SHELL_COMMAND CMD=zlink PARAMS="enable {p} {u} {m} {c}"
{% endif %}
[gcode_macro ZLINK_OFF]
gcode:
RESPOND TYPE="echo" MSG="zmod.link off"
RUN_SHELL_COMMAND CMD=zlink PARAMS="disable"
[gcode_macro ZSSH_OFF]
description: ===Disable SSH port forwarding===
gcode:
RUN_SHELL_COMMAND CMD=zssh PARAMS="STOP 127.0.0.1 22 user 8080 7125 NONE RESTART"
[gcode_macro ZSSH_RESTART]
description: ===SSH restart===
gcode:
RUN_SHELL_COMMAND CMD=zssh PARAMS="RESTART 127.0.0.1 22 user 8080 7125 NONE RESTART"
_CHECK_VERSION
[gcode_macro ZSSH_RELOAD]
description: ===Start SSH if not running===
gcode:
{% set screen = printer["gcode_macro _SCREEN"].screen %}
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] | default({}) %}
{% if screen == True %}
RESPOND PREFIX="info" MSG="===You are using native screen==="
{% else %}
RESPOND PREFIX="info" MSG="===You are NOT using native screen==="
{% endif %}
{% set zklipper13 = printer.save_variables.variables['klipper13']|default(0) | int %}
{% if zklipper13 == 1 %}
RESPOND PREFIX="//" MSG="===Using Klipper 13==="
{% else %}
{% if not client.ad5x %}
RESPOND PREFIX="//" MSG="===Using native Klipper=== 11"
{% else %}
RESPOND PREFIX="//" MSG="===Using native Klipper=== 12"
{% endif %}
{% endif %}
M115
_CHECK_VERSION
RUN_SHELL_COMMAND CMD=zssh PARAMS="RELOAD 127.0.0.1 22 user 8080 7125 NONE RESTART"
[gcode_macro _FIND_POINT]
# Поиск точки для измерения
gcode:
{% set extruder_temp = printer["gcode_macro _START_PRINT"].zextruder_temp|float %}
{% set bed_temp = printer["gcode_macro _START_PRINT"].zbed_temp|float %}
{% set mesh_test = printer.save_variables.variables['mesh_test']|default(1) | int %}
SET_GCODE_VARIABLE MACRO=_PROBE_POINT VARIABLE=find VALUE=False
SET_GCODE_VARIABLE MACRO=_TEST_POINT VARIABLE=temp_z_offset VALUE=0.0
{% set bed_mesh = printer.bed_mesh %}
{% if not bed_mesh.profile_name %}
{ action_respond_info("===Profile or mesh matrix not found===") }
{% else %}
{% set min_x = bed_mesh.mesh_min[0]|float %}
{% set max_x = bed_mesh.mesh_max[0]|float %}