forked from tyrscgm/Demon_KLIPPER_Essentials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemon_print_start_end_v2.5.cfg
757 lines (547 loc) · 31.4 KB
/
demon_print_start_end_v2.5.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
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
###################################################
#######>>>>>>>>>> 3DPrintDemon <<<<<<<<<<<#######
####### https://github.com/3DPrintDemon #######
# IF YOU USE & LIKE THESE MACROS PLEASE CONSIDER SUPPORTING MY EFFORTS AT
# https://ko-fi.com/3dprintdemon
########################## VERY IMPORTANT ###############################
#########################################################################
# FOR THIS TO WORK!!!
# YOU MUST DO THIS!!!
#########################################################################
# ADD THE 3 LINES BELOW TO PRUSASLICER'S START GCODE SECTION
#########################################################################
# M104 S0
# M140 S0
# print_start EXTRUDER=[first_layer_temperature[initial_extruder]] BED=[first_layer_bed_temperature] LAYER=[layer_height] FILAMENT=[filament_type] EXTRUSION=[external_perimeter_extrusion_width]
# #########################################################################
# IF YOU USE ORCA SLICER - you have extra features available to you!
# ADD THE 3 LINES BELOW TO ORCA SLICER'S START GCODE SECTION
#########################################################################
# M104 S0
# M140 S0
# PRINT_START EXTRUDER=[nozzle_temperature_initial_layer] BED=[hot_plate_temp_initial_layer] LAYER=[layer_height] FILAMENT=[filament_type] EXTRUSION=[outer_wall_line_width] EXCLUDE=[exclude_object]
#########################################################################
# ORCA SLICER ONLY!!
#########################################################################
# To enable Orca slicer only Adaptive Pressure Advance features paste the line below into the "Change extrusion role G-code" box near the bottom of the "Machine G-code" tab of your "Printer settings".
# Be sure to save your changes & then set "variable_orca_enable:" to "True" in the user_settings.cfg file.
# _ADAPTIVE_PA TYPE=[extrusion_role]
#########################################################################
# IF YOU USE CURA ADD THE 3 LINES BELOW TO CURA SLICER'S START GCODE SECTION
#########################################################################
# M109 S0
# M190 S0
# print_start EXTRUDER={material_print_temperature_layer_0} BED={material_bed_temperature_layer_0} LAYER={layer_height} FILAMENT={material_type} EXTRUSION={line_width}
#########################################################################
#########################################################################
# Also be sure to add the line below in your slicer's End G-Code box
# PRINT_END
#########################################################################
# BE SURE TO DELETE THE HASH "#" AT THE LINE START IN YOUR SLICER OR IT WONT WORK
# Your slicer's Start G-Code box most only contain those 3 lines above, plus the Mainsail layer count command - see mailsail website, slicer.
# Your slicer's End G-Code box must only contain that line above
# https://docs.mainsail.xyz/overview/slicer
#########################################################################
############# YOU'LL NEED THIS!!!! ###############
# DOWNLOAD THE HEAT SOAK TIMERS .CFG HERE >>>> https://github.com/3DPrintDemon/Non_Blocking_Wait_Sovol/releases/tag/Heat_Soak_Timers_V1.0
# You can add a spare or empty pin on your board if you dont have any actual LED's, it'll still work.
#########################################################################
# BEFORE FIRST USE
#########################################################################
# CHECK YOUR VALUES ARE CORRECT BEFORE USE, THIS IS VITAL & TOTALLY ON YOU!
# DO NOT BLINDLY USE THESE DEFAULTS!!
# USE THESE MACROS AT YOUR OWN RISK!
# DONT CRY TO ME IF YOU DIDN'T CHECK/CHANGE VALUES & YOU BREAK THINGS!
# >>>>>>>>>>>>>>>>>>>>>>>>>!!WARNING!!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
# THIS START CODE USES RELATIVE EXTRUSION!! SET IT IN YOUR SLICER!
# This macro relies on you setting the correct filament type in your slicer! BE SURE YOU DO THIS! OR IT WILL NOT WORK!!
################ IMPORTANT!!! BUILD NEW BED MESHES WITH THE BED AT THE TEMPS YOU PRINT AT FOR EACH TYPE OF FILAMENT LIST BELOW! ###################
##################################### ALLOW TO HEAT SOAK 10-15 MINUTES THEN HOME BEFORE BUILDING MESH!! ###########################################
########################################### BUILD & STORE 5 MESHES TOTAL INCLUDING YOUR DEFAULT ###################################################
################################################ DO NOT OVERWRITE YOUR "DEFAULT" MESH!!! ##########################################################
# The 5 meshes to build, use the new auto mesh builder macro!
# default #<<<< USED FOR PLA & undefined profiles (default settings below)
# ASA
# ABS
# PETG
# TPU
# IF YOU USE & LIKE THESE MACROS PLEASE CONSIDER SUPPORTING MY EFFORTS AT
# https://ko-fi.com/3dprintdemon
# DONT PLAY WITH THINGS HERE UNLESS YOU KNOW WHAT YOURE DOING, BAD THINGS CAN HAPPEN IF YOU BREAK STUFF :-0
[gcode_macro PRINT_START]
gcode:
# Do not edit this section, this gets the info from the print file
{% set first_layer_bed = params.BED|int %}
{% set first_layer_extruder = params.EXTRUDER|float %}
{% set layer_height = params.LAYER|default(0.2)|float %}
{% set filament_type = params.FILAMENT|default('PLA')|string %}
{% set extrusion_width = params.EXTRUSION|default(0.4)|float %}
{% set exclude_object = params.EXCLUDE|default(0)|int %}
{% set x_park = printer.toolhead.axis_maximum.x|float / 2 %}
{% set y_park = printer.toolhead.axis_maximum.y|float / 2 %}
{% set start_vars = printer["gcode_macro _START_VARIABLES"] %}
## PREPARE ####################################################################################################################################
{% if start_vars.orca_enable == True %}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=fil_type VALUE='"{filament_type}"'
_APA_SET
{% endif %}
_DEMON_VERSION
{% if start_vars.orca_enable == True %}
{% if start_vars.adaptive_meshing == True and exclude_object != 1 %}
{action_raise_error("This error is caused by the sliced file not having EXCLUDE_OBJECT enabled! Please disable Adaptive_Meshing in the user_settings.cfg or re-slice the file with it enabled and restart the print!")}
{% endif %}
{% endif %}
{% if start_vars.printer_lights == True %}
{% if printer["my_led"] != start_vars.printer_lights_print %}
SET_PIN PIN=my_led VALUE={start_vars.printer_lights_print}
{% endif %}
{% endif %}
## STATE RESET TO PRINT ############################################################################################################################
G90 ; Use absoulte coordinates
M83 ; Extruder relative mode
SET_GCODE_OFFSET Z=0.0 # Reset the G-Code Z offset
BED_MESH_CLEAR # Clears currently loaded mesh
## INITIAL SETUP ############################################################################################################################
M220 S{start_vars.feed_rate}
{% if filament_type in ['PLA', 'PLA+'] and layer_height|float <0.25%}
M221 S{start_vars.pla_flow_rate}
SET_PRESSURE_ADVANCE ADVANCE={start_vars.pla_pa} SMOOTH_TIME={start_vars.pla_st}
{% elif filament_type == 'ASA' and layer_height|float <0.25%}
M221 S{start_vars.asa_flow_rate}
SET_PRESSURE_ADVANCE ADVANCE={start_vars.asa_pa} SMOOTH_TIME={start_vars.asa_st}
{% elif filament_type == 'ABS' and layer_height|float <0.25%}
M221 S{start_vars.abs_flow_rate}
SET_PRESSURE_ADVANCE ADVANCE={start_vars.abs_pa} SMOOTH_TIME={start_vars.abs_st}
{% elif filament_type in ['PET', 'PETG'] and layer_height|float <0.25%}
M221 S{start_vars.petg_flow_rate}
SET_PRESSURE_ADVANCE ADVANCE={start_vars.petg_pa} SMOOTH_TIME={start_vars.petg_st}
{% elif filament_type in ['FLEX', 'TPU'] and layer_height|float <0.25%}
M221 S{start_vars.tpu_flow_rate}
SET_PRESSURE_ADVANCE ADVANCE={start_vars.tpu_pa} SMOOTH_TIME={start_vars.tpu_st}
{% elif filament_type in ['PLA', 'PLA+'] and layer_height|float >0.26%}
M221 S{start_vars.pla_hi_flow_rate}
SET_PRESSURE_ADVANCE ADVANCE={start_vars.pla_pa} SMOOTH_TIME={start_vars.pla_st}
{% elif filament_type == 'ASA' and layer_height|float >0.26%}
M221 S{start_vars.asa_hi_flow_rate}
SET_PRESSURE_ADVANCE ADVANCE={start_vars.asa_pa} SMOOTH_TIME={start_vars.asa_st}
{% elif filament_type == 'ABS' and layer_height|float >0.26%}
M221 S{start_vars.abs_hi_flow_rate}
SET_PRESSURE_ADVANCE ADVANCE={start_vars.abs_pa} SMOOTH_TIME={start_vars.abs_st}
{% elif filament_type in ['PET', 'PETG'] and layer_height|float >0.26%}
M221 S{start_vars.petg_hi_flow_rate}
SET_PRESSURE_ADVANCE ADVANCE={start_vars.petg_pa} SMOOTH_TIME={start_vars.petg_st}
{% elif filament_type in ['FLEX', 'TPU'] and layer_height|float >0.26%}
M221 S{start_vars.tpu_hi_flow_rate}
SET_PRESSURE_ADVANCE ADVANCE={start_vars.tpu_pa} SMOOTH_TIME={start_vars.tpu_st}
{% endif %}
## FILAMENT STATE CHECK ############################################################################################################################
{% if start_vars.runout_sensor == True %}
{% if not printer["filament_switch_sensor filament_sensor"].filament_detected %} # Runout Sensor Check, E-Stop if empty!
{action_raise_error("This error is caused by no filament loaded! Please load filament & restart the print!")}
{% endif %}
{% endif %}
M400
## INITIAL BED HEATING ############################################################################################################################
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={first_layer_bed}
## NOZZLE PREHEATING ############################################################################################################################
{% if filament_type in ['PLA', 'PLA+'] %}
SET_DISPLAY_TEXT MSG="PLA File Detected Hotend Preheat: {start_vars.pla_noz_pre}c" # Displays info
RESPOND TYPE=COMMAND MSG="PLA File Detected Hotend Preheat: {start_vars.pla_noz_pre}c" # Displays info
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={start_vars.pla_noz_pre}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={start_vars.pla_noz_pre|float -2} MAXIMUM={start_vars.pla_noz_pre|float + 5}
{% elif filament_type == 'ASA' %}
SET_DISPLAY_TEXT MSG="ASA File Detected Hotend Preheat: {start_vars.asa_noz_pre}c" # Displays info
RESPOND TYPE=COMMAND MSG="ASA File Detected Hotend Preheat: {start_vars.asa_noz_pre}c" # Displays info
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={start_vars.asa_noz_pre}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={start_vars.asa_noz_pre|float -2} MAXIMUM={start_vars.asa_noz_pre|float + 5}
{% elif filament_type == 'ABS' %}
SET_DISPLAY_TEXT MSG="ABS File Detected Hotend Preheat: {start_vars.abs_noz_pre}c" # Displays info
RESPOND TYPE=COMMAND MSG="ABS File Detected Hotend Preheat: {start_vars.abs_noz_pre}c" # Displays info
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={start_vars.abs_noz_pre}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={start_vars.abs_noz_pre|float -2} MAXIMUM={start_vars.abs_noz_pre|float + 5}
{% elif filament_type in ['PET', 'PETG'] %}
SET_DISPLAY_TEXT MSG="PETG File Detected Hotend Preheat: {start_vars.petg_noz_pre}c" # Displays info
RESPOND TYPE=COMMAND MSG="PETG File Detected Hotend Preheat: {start_vars.petg_noz_pre}c" # Displays info
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={start_vars.petg_noz_pre}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={start_vars.petg_noz_pre|float -2} MAXIMUM={start_vars.petg_noz_pre|float + 5}
{% elif filament_type in ['FLEX', 'TPU'] %}
SET_DISPLAY_TEXT MSG="TPU File Detected Hotend Preheat: {start_vars.tpu_noz_pre}c" # Displays info
RESPOND TYPE=COMMAND MSG="TPU File Detected Hotend Preheat: {start_vars.tpu_noz_pre}c" # Displays info
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={start_vars.tpu_noz_pre}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={start_vars.tpu_noz_pre|float -2} MAXIMUM={start_vars.tpu_noz_pre|float + 5}
{% elif not filament_type in ['PLA', 'PLA+', 'ASA', 'ABS', 'PET', 'PETG', 'FLEX', 'TPU'] %}
{% if params.EXTRUDER|float <220 %}
SET_DISPLAY_TEXT MSG="Hotend Preheat by file temp: {start_vars.default_lo_noz_pre}c" # Displays info
RESPOND TYPE=COMMAND MSG="Hotend Preheat by file temp: {start_vars.default_lo_noz_pre}c" # Displays info
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={start_vars.default_lo_noz_pre}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={start_vars.default_lo_noz_pre|float -2} MAXIMUM={start_vars.default_lo_noz_pre|float + 5}
{% else %}
SET_DISPLAY_TEXT MSG="Hotend Preheat by file temp: {start_vars.default_hi_noz_pre}c" # Displays info
RESPOND TYPE=COMMAND MSG="Hotend Preheat by file temp: {start_vars.default_hi_noz_pre}c" # Displays info
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={start_vars.default_hi_noz_pre}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={start_vars.default_hi_noz_pre|float -2} MAXIMUM={start_vars.default_hi_noz_pre|float + 5}
{% endif %}
{% endif %}
M400
## HOMING ############################################################################################################################
{% if "xyz" not in printer.toolhead.homed_axes %}
# M117 Homing...
SET_DISPLAY_TEXT MSG="Homing..."
RESPOND TYPE=COMMAND MSG="Homing..."
G28
{% endif %}
## CHAMBER FAN SETTING ############################################################################################################################
{% if start_vars.chamber_fan == True %}
{% if filament_type in ['PLA', 'PLA+'] %}
SET_TEMPERATURE_FAN_TARGET temperature_fan="chamber" target={start_vars.pla_chamber_temp}
RESPOND TYPE=COMMAND MSG="Setting Chamber Fan Temp: PLA {start_vars.pla_chamber_temp}c"
{% elif filament_type == 'ASA' %}
SET_TEMPERATURE_FAN_TARGET temperature_fan="chamber" target={start_vars.asa_chamber_temp}
RESPOND TYPE=COMMAND MSG="Setting Chamber Fan Temp: ASA {start_vars.asa_chamber_temp}c"
{% elif filament_type == 'ABS' %}
SET_TEMPERATURE_FAN_TARGET temperature_fan="chamber" target={start_vars.abs_chamber_temp}
RESPOND TYPE=COMMAND MSG="Setting Chamber Fan Temp: ABS {start_vars.abs_chamber_temp}c"
{% elif filament_type in ['PET', 'PETG'] %}
SET_TEMPERATURE_FAN_TARGET temperature_fan="chamber" target={start_vars.petg_chamber_temp}
RESPOND TYPE=COMMAND MSG="Setting Chamber Fan Temp: PETG {start_vars.petg_chamber_temp}c"
{% elif filament_type in ['FLEX', 'TPU'] %}
SET_TEMPERATURE_FAN_TARGET temperature_fan="chamber" target={start_vars.tpu_chamber_temp}
RESPOND TYPE=COMMAND MSG="Setting Chamber Fan Temp: TPU {start_vars.tpu_chamber_temp}c"
{% else %}
SET_TEMPERATURE_FAN_TARGET temperature_fan="chamber" target={start_vars.default_chamber_temp}
RESPOND TYPE=COMMAND MSG="Setting Chamber Fan Temp: Default {start_vars.default_chamber_temp}c"
{% endif %}
{% endif %}
M400
## STORED BED MESH OR ADAPTIVE #########################################################################################################################
{% if start_vars.adaptive_meshing == True %}
{% else %}
{% if filament_type in ['PLA', 'PLA+'] %}
BED_MESH_PROFILE LOAD="default"
RESPOND TYPE=COMMAND MSG="Default mesh loaded"
{% elif filament_type == 'ASA' %}
BED_MESH_PROFILE LOAD="ASA"
SET_GCODE_VARIABLE MACRO=PRINT_END VARIABLE=offset_reset VALUE=True
RESPOND TYPE=COMMAND MSG="ASA mesh loaded"
{% elif filament_type == 'ABS' %}
BED_MESH_PROFILE LOAD="ABS"
SET_GCODE_VARIABLE MACRO=PRINT_END VARIABLE=offset_reset VALUE=True
RESPOND TYPE=COMMAND MSG="ABS mesh loaded"
{% elif filament_type in ['PET', 'PETG'] %}
BED_MESH_PROFILE LOAD="PETG"
SET_GCODE_VARIABLE MACRO=PRINT_END VARIABLE=offset_reset VALUE=True
RESPOND TYPE=COMMAND MSG="PETG mesh loaded"
{% elif filament_type in ['FLEX', 'TPU'] %}
BED_MESH_PROFILE LOAD="TPU"
SET_GCODE_VARIABLE MACRO=PRINT_END VARIABLE=offset_reset VALUE=True
RESPOND TYPE=COMMAND MSG="TPU mesh loaded"
{% else %}
{% if params.BED|float < 90 %}
BED_MESH_PROFILE LOAD="default"
RESPOND TYPE=COMMAND MSG="Default mesh by temp loaded"
{% else %}
BED_MESH_PROFILE LOAD="ASA"
SET_GCODE_VARIABLE MACRO=PRINT_END VARIABLE=offset_reset VALUE=True
RESPOND TYPE=COMMAND MSG="ASA mesh by temp loaded"
{% endif %}
{% endif %}
{% endif %}
## APPLY OFFSET ADJUSTMENTS ############################################################################################################################
## Use with EXTREME caution!! Manual G-Code Z offset override!
{% if start_vars.high_temp_expansion_offset and filament_type in ['ASA', 'ABS'] %}
{% if start_vars.high_temp_offset >= -0.1 and start_vars.high_temp_offset <= 0.1%}
SET_GCODE_OFFSET Z_ADJUST={start_vars.high_temp_offset} MOVE=1
SET_DISPLAY_TEXT MSG="REQUESTED HIGH TEMP OFFSET ADJUSTMENT APPLIED"
RESPOND TYPE=echo MSG="REQUESTED HIGH TEMP OFFSET ADJUSTMENT APPLIED"
G4 P10000
{% else %}
{action_emergency_stop("EMERGENCY STOP! EXCESSIVE HIGH TEMP OFFSET REQUESTED CORRECT IN USER SETTINGS FILE")}
{% endif %}
{% elif start_vars.petg_anti_squish == True and filament_type in ['PET', 'PETG'] %}
{% if start_vars.petg_offset >= 0.0 and start_vars.petg_offset <= 0.1%}
SET_GCODE_OFFSET Z_ADJUST={start_vars.petg_offset} MOVE=1
SET_DISPLAY_TEXT MSG="REQUESTED PETG OFFSET ADJUSTMENT APPLIED"
RESPOND TYPE=echo MSG="REQUESTED PETG OFFSET ADJUSTMENT APPLIED"
G4 P10000
{% else %}
{action_emergency_stop("EMERGENCY STOP! NEGATIVE OR EXCESSIVE PETG OFFSET REQUESTED CORRECT IN USER SETTINGS FILE")}
{% endif %}
{% endif %}
## BED TEMP WAITS & TIMERS ############################################################################################################################
SET_DISPLAY_TEXT MSG="Waiting For Bed Temp: {first_layer_bed}c"
RESPOND TYPE=COMMAND MSG="Waiting For Bed Temp: {first_layer_bed}c"
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={first_layer_bed}
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={first_layer_bed|int -2} MAXIMUM={first_layer_bed|int + 5}
RESPOND TYPE=COMMAND MSG="Bed Temp Reached"
{% if start_vars.chamber_sensor == True %}
{% if filament_type in ['PLA', 'PLA+', 'PET', 'PETG', 'FLEX', 'TPU'] %}
{% if printer["temperature_sensor Chamber_Temp"].temperature <start_vars.lo_heat_soak_threshold %}
G1 X{x_park} Y{y_park} Z5 F4000 # Goes to center of the bed
{% if start_vars.chamber_temp_wait == True %}
SET_DISPLAY_TEXT MSG="Waiting For Chamber Temp: {start_vars.lo_heat_soak_threshold}c"
RESPOND TYPE=COMMAND MSG="Waiting For Chamber Temp: {start_vars.lo_heat_soak_threshold}c"
TEMPERATURE_WAIT SENSOR="temperature_sensor Chamber_Temp" MINIMUM={start_vars.lo_heat_soak_threshold|float}
RESPOND TYPE=COMMAND MSG="Chamber Temp Reached"
{% else %}
_HEAT_WAIT MINUTES={start_vars.lo_temp_timer}
RESPOND TYPE=COMMAND MSG="Running Low Temp Chamber Timer via sensor"
{% endif %}
{% else %}
SET_DISPLAY_TEXT MSG="Already up to {filament_type} temp, heat soak skipped"
RESPOND TYPE=COMMAND MSG="Already up to {filament_type} temp, heat soak skipped"
G4 P5000
{% endif %}
{% elif filament_type in ['ASA', 'ABS'] %}
{% if printer["temperature_sensor Chamber_Temp"].temperature <start_vars.hi_heat_soak_threshold %}
G1 X{x_park} Y{y_park} Z5 F4000 # Goes to center of the bed
{% if start_vars.chamber_temp_wait == True %}
SET_DISPLAY_TEXT MSG="Waiting For Chamber Temp: {start_vars.hi_heat_soak_threshold}c"
RESPOND TYPE=COMMAND MSG="Waiting For Chamber Temp: {start_vars.hi_heat_soak_threshold}c"
M106 S255
TEMPERATURE_WAIT SENSOR="temperature_sensor Chamber_Temp" MINIMUM={start_vars.hi_heat_soak_threshold|float}
RESPOND TYPE=COMMAND MSG="Chamber Temp Reached"
{% else %}
M106 S255
_HEAT_WAIT MINUTES={start_vars.hi_temp_timer}
RESPOND TYPE=COMMAND MSG="Running High Temp Chamber Timer via sensor"
{% endif %}
{% else %}
SET_DISPLAY_TEXT MSG="Already up to {filament_type} temp, heat soak skipped"
RESPOND TYPE=COMMAND MSG="Already up to {filament_type} temp, heat soak skipped"
G4 P5000
{% endif %}
{% else %}
{% if printer["temperature_sensor Chamber_Temp"].temperature <start_vars.default_heat_soak_threshold %}
_HEAT_WAIT MINUTES={start_vars.default_temp_timer}
G1 X{x_park} Y{y_park} Z5 F4000 # Goes to center of the bed
{% if start_vars.chamber_temp_wait == True %}
SET_DISPLAY_TEXT MSG="Waiting For Chamber Temp: {start_vars.default_heat_soak_threshold}c"
RESPOND TYPE=COMMAND MSG="Waiting For Chamber Temp: {start_vars.default_heat_soak_threshold}c"
TEMPERATURE_WAIT SENSOR="temperature_sensor Chamber_Temp" MINIMUM={start_vars.default_heat_soak_threshold|float}
RESPOND TYPE=COMMAND MSG="Chamber Temp Reached"
{% elif start_vars.chamber_temp_wait == False %}
_HEAT_WAIT MINUTES={start_vars.default_temp_timer}
RESPOND TYPE=COMMAND MSG="Running Default Temp Chamber Timer via sensor"
{% endif %}
{% else %}
SET_DISPLAY_TEXT MSG="Already up to Default temp heat soak skipped"
RESPOND TYPE=COMMAND MSG="Already up to {filament_type} temp, heat soak skipped"
G4 P5000
{% endif %}
{% endif %}
{% endif %}
{% if start_vars.chamber_sensor == False %}
{% if filament_type in ['PLA', 'PLA+', 'PET', 'PETG', 'FLEX', 'TPU'] %}
RESPOND TYPE=COMMAND MSG="Running Low Temp Chamber Timer via Fliament Type"
G1 X{x_park} Y{y_park} Z5 F4000 # Goes to center of the bed
_HEAT_WAIT MINUTES={start_vars.lo_temp_timer}
{% elif filament_type in ['ASA', 'ABS'] %}
RESPOND TYPE=COMMAND MSG="Running High Temp Chamber Timer via Fliament Type"
G1 X{x_park} Y{y_park} Z5 F4000 # Goes to center of the bed
# M106 S255
_HEAT_WAIT MINUTES={start_vars.hi_temp_timer}
{% else %}
{% if params.BED|float < 90 %}
RESPOND TYPE=COMMAND MSG="Running Low Temp Chamber Timer via File Temps"
G1 X{x_park} Y{y_park} Z5 F4000 # Goes to center of the bed
_HEAT_WAIT MINUTES={start_vars.lo_temp_timer}
{% else %}
RESPOND TYPE=COMMAND MSG="Running High Temp Chamber Timer via File Temps"
G1 X{x_park} Y{y_park} Z5 F4000 # Goes to center of the bed
# M106 S255
_HEAT_WAIT MINUTES={start_vars.hi_temp_timer}
{% endif %}
{% endif %}
{% endif %}
M107 # Turns off parts cooling fan
## GANTRY LEVELLING & ADAPTIVE MESHING #######################################################################################################################
{% if start_vars.five_drivers == True %}
G28 Z
SET_DISPLAY_TEXT MSG="Gantry Levelling"
RESPOND TYPE=COMMAND MSG="Gantry Levelling"
Z_TILT_ADJUST
{% endif %}
G28 Z
{% if start_vars.adaptive_meshing == True %}
BED_MESH_CALIBRATE PROFILE=DAM ADAPTIVE=1 ADAPTIVE_MARGIN=10
{% endif %}
## MOVE TO START POSITION & READY ############################################################################################################################
{% if start_vars.start_x_position >= 50 or start_vars.start_y_position >= 50%}
{action_emergency_stop("EMERGENCY STOP! EXCESSIVE START POSITION REQUESTED CORRECT IN USER SETTINGS FILE")}
{% elif start_vars.purge_line_length|float > 150 %}
{action_emergency_stop("EMERGENCY STOP! EXCESSIVE PURGE LENGTH REQUESTED CORRECT IN USER SETTINGS FILE")}
{% endif %}
SET_DISPLAY_TEXT MSG="Moving to Start Position"
RESPOND TYPE=COMMAND MSG="Moving to Start Position"
G0 Z10 F5000
G0 X{start_vars.start_x_position} Y{start_vars.start_y_position} F5000 # Move to start position
G0 Z5.0 F5000 # Lower speed
G0 Z0.5 F150 # Lower slow for wait & to catch oozing nozzle during heating
# Heats up the nozzle up to target via data from slicer
SET_DISPLAY_TEXT MSG="Heating Hotend: {first_layer_extruder}c"
RESPOND TYPE=COMMAND MSG="Heating Hotend: {first_layer_extruder}c"
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={first_layer_extruder}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={first_layer_extruder|float -2} MAXIMUM={first_layer_extruder|float + 5}
## PRINT PURGE LINES ############################################################################################################################
_PURGE_LINES
[gcode_macro _PURGE_LINES]
gcode:
{% set start_vars = printer["gcode_macro _START_VARIABLES"] %}
{% set height = (printer.configfile.settings.extruder.nozzle_diameter * 0.75)|float %}
{% set width = (printer.configfile.settings.extruder.nozzle_diameter * 1.25)|float %}
{% set filament_area = 3.14159 * (printer.configfile.settings.extruder.filament_diameter ** 2) / 4 %}
{% set rate = start_vars.purge_line_length * ((width * height) / filament_area) %}
SET_DISPLAY_TEXT MSG="Printing Purge Lines"
RESPOND TYPE=COMMAND MSG="Printing Purge Lines"
G90 # Absolute mode
G0 Z1.5 F9000 # Jump up to leave ooze blob
G91 # Relative mode
{% if start_vars.purge_along_y == True %}
G0 Y7 F9000 # Move away from ooze blob
{% else %}
G0 X7 F9000
{% endif %}
G90 # Absolute mode
G0 Z{height} F1500
G91 # Relative mode
{% if start_vars.purge_along_y == True %}
G1 Y{start_vars.purge_line_length} E{rate} F1500 # Draw the first line
G0 X{width +0.4} F5000 # Move to side a little
G1 Y-{start_vars.purge_line_length -15} E{rate} F1500
# G4 P2000 # wait 02 seconds
{% else %}
G1 X{start_vars.purge_line_length} E{rate} F1500 # Draw the first line
G0 Y{width} F5000 # Move to side a little
G1 X-{start_vars.purge_line_length -15} E{rate} F1500
# G4 P2000 # wait 02 seconds
{% endif %}
G0 Z{height} F9000 # Lift a little
G0 X5 Y5 F9000 # Wipe Out
G90 # Absolute mode
G92 E0.0 # Reset Extruder
M83 # Extruder relative mode
G0 Z5.0 F9000 # Move Z Axis up little to prevent scratching of Heat Bed
M400
SET_DISPLAY_TEXT MSG="Print Start..."
RESPOND TYPE=COMMAND MSG="Print Start..."
#######################################################
# Used to finish your print & leave your printer in a safe state
#######################################################
[gcode_macro PRINT_END]
variable_offset_reset: False
gcode:
{% set start_vars = printer["gcode_macro _START_VARIABLES"] %}
G91 # RELATIVE POSITIONING
G1 E-2 F2700 # RETRACT A BIT
G1 E-2 Z0.2 F2400 # RETRACT AND RAISE Z
G1 X5 Y5 F9000 # WIPE OUT
G90 # ABSOLUTE POSITIONING
{% if printer.toolhead.position.z|float < 50 %}
G0 Z50 F3600
{% endif %}
{% if offset_reset == True %}
SET_GCODE_OFFSET Z=0 MOVE=1 # Reset the G-Code Z offset
{% endif %}
{% if start_vars.chamber_fan == True %}
SET_TEMPERATURE_FAN_TARGET temperature_fan="chamber" target={start_vars.post_print_cool}
{% endif %}
SET_DISPLAY_TEXT MSG="Print Complete!"
RESPOND TYPE=COMMAND MSG="Print Complete!"
_TOOLHEAD_PARK_PAUSE_CANCEL # park head & present print
M104 S0 # kill extruder temperature
M140 S0 # kill bed temperature
M84 X Y E # DISABLE ALL STEPPERS BUT Z
M220 S100 # reset feed rate to 100 percent
M221 S100 # reset flow rate to 100 percent
BED_MESH_CLEAR
{% if start_vars.shutdown_relay == True %}
{% if printer["output_pin PRINTER_AUTO_OFF"].value == 1.0 %}
_GOODNIGHT
{% else %}
M107 # kill fan
M117
{% endif %}
{% else %}
M107 # kill fan
M117
{% endif %}
{% if start_vars.printer_lights == True %}
{% if printer["my_led"] != start_vars.printer_lights_finish %}
SET_PIN PIN=my_led VALUE={start_vars.printer_lights_finish}
{% endif %}
{% endif %}
; total layers count = [total_layer_count]
#######################################################
# Use this macro to calibrate your retractoin settings when using the generated files from http://www.retractioncalibration.com/
# All you need do is paste "_RET_CALI_START" into the website's "Custom Gcode" box next to the green "Generate Gcode" button
#######################################################
[gcode_macro _RET_CALI_START]
gcode:
BED_MESH_PROFILE LOAD="default"
{% if start_vars.five_drivers == True %}
SET_DISPLAY_TEXT MSG="Gantry Levelling"
G28 Z
Z_TILT_ADJUST
{% endif %}
G28 Z
M117 Start Position
G0 X0.4 Y03 Z25 F5000
G0 X0.4 Y03 Z5.0 F5000 # Move to start position
G0 Z0.5 F150 # Lower to ready
M117 Printing Purge Lines
G0 Z1.5 F9000
G0 Y10 F9000
G0 Z0.5 F1500
G4 P2000 # wait 2 seconds
G0 Z0.30 F150 # Move lower to first layer height
G1 X0.4 Y150 F1500.0 E15 # Draw the first line
G0 X0.7 Y150 F5000.0 # Move to side a little
G1 X0.7 Y20 F1500.0 E30 # Draw the second line
#G4 P2000 # wait 02 seconds
M117 Print Start...
G0 Z0.6 F1500 # Lift A BIT
G92 E0.0 # Reset Extruder
G0 Z3.0 F1500 # Move Z Axis up little to prevent scratching of Heat Bed
M117
#######################################################
# If you have a power on/off relay
# This macro is used to shutdown your printer after printing
# It is called by the END_PRINT macro
#######################################################
[gcode_macro _GOODNIGHT]
gcode:
M106 S255 # max part fan to cool
M117 Cooling Hotend....
M109 S49 # reach temp
M400 # wait
M107 # kill fan
M81 # printer power off
M117 GOODNIGHT...Zzzzzz
M118 GOODNIGHT...Zzzzzz
#######################################################
# SYSTEM MACROS DO NOT EDIT
#######################################################
[gcode_macro _DEMON_VERSION]
gcode:
{% set start_vars = printer["gcode_macro _START_VARIABLES"] %}
{% set de_vars = printer["gcode_macro _DE_VERSION_VARIABLES"] %}
{% set pm_vars = printer["gcode_macro _PM_VERSION_VARIABLES"] %}
{% set bm_vars = printer["gcode_macro _BM_VERSION_VARIABLES"] %}
{% set ap_vars = printer["gcode_macro _AP_VERSION_VARIABLES"] %}
{% if not start_vars.demon_version|float == 2.5 %}
_DEMON_VERSION_MISMATCH
{% elif not de_vars.demon_essensials|float == 1.2 %}
_DEMON_VERSION_MISMATCH
{% elif not pm_vars.demon_prepare_menu|float == 1.0 %}
_DEMON_VERSION_MISMATCH
{% elif not bm_vars.demon_bed_mesh|float == 1.0 %}
_DEMON_VERSION_MISMATCH
{% elif not ap_vars.demon_apa|float == 1.0 %}
_DEMON_VERSION_MISMATCH
{% endif %}
[gcode_macro _DEMON_VERSION_MISMATCH]
gcode:
RESPOND TYPE=error MSG="EMERGENCY STOP! Demon_version mismatch please update your Demon Macro files!"
M117 EMERGENCY STOP! Demon_version mismatch please update your Demon Macro files!
G4 P15000
M112 # E-Stop & shutdown