-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprinter-20240127_234409.cfg
939 lines (780 loc) · 29.3 KB
/
printer-20240127_234409.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
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
[include mainsail.cfg]
[display_status]
[include K-ShakeTune/*.cfg]
### Github Backup ###
[gcode_shell_command backup_cfg]
command: /usr/bin/bash /home/pi/printer_data/config/autocommit.sh
timeout: 30
verbose: True
[gcode_macro BACKUP_CFG]
description: Backs up config directory GitHub
gcode:
RUN_SHELL_COMMAND CMD=backup_cfg
# Enable arcs support
[gcode_arcs]
resolution: 0.1
### MCU ###
[mcu]
#serial: /dev/serial/by-id/usb-Klipper_stm32f407xx_33002C000F47313337303439-if00
#serial: /dev/serial/by-id/usb-Klipper_stm32f407xx_3C001E000F47323137363638-if00
serial: /dev/serial/by-id/usb-Klipper_stm32f407xx_2C0032001850324239333220-if00
[mcu EBBCan]
#serial: /dev/serial/by-id/usb-Klipper_Klipper_firmware_12345-if00
canbus_uuid: 11ad927c6dea
### Virtual SD Card ###
[virtual_sdcard]
path: /home/pi/printer_data/gcodes
on_error_gcode: CANCEL_PRINT
### Printer ###
[printer]
kinematics: corexy
max_velocity: 1000
max_accel: 4500
max_z_velocity: 100
max_z_accel: 800
### Steppers ###
[stepper_x]
step_pin: PE9
dir_pin: PF1
enable_pin: !PF2
microsteps: 16
rotation_distance: 32
endstop_pin: EBBCan: PB6
position_endstop: 0
position_max: 298
homing_speed: 50
[stepper_y]
step_pin: PE11
dir_pin: PE8
enable_pin: !PD7
microsteps: 16
rotation_distance: 32
endstop_pin: PE12
position_endstop: 0
position_max: 295
homing_speed: 50
[stepper_z]
step_pin: PE13
dir_pin: PC2
enable_pin: !PC0
microsteps: 16
rotation_distance: 32
endstop_pin: probe:z_virtual_endstop
position_min: -5
position_max: 385
homing_speed: 30
second_homing_speed: 10
[stepper_z1]
step_pin: PE14
dir_pin: PA0
enable_pin: !PC3
microsteps: 16
rotation_distance: 32
#endstop_pin: probe:z_virtual_endstop
#position_min: -5
#position_max: 385
[stepper_z2]
step_pin: PD15
dir_pin: PE7
enable_pin: !PA3
microsteps: 16
rotation_distance: 32
#endstop_pin: probe:z_virtual_endstop
#position_min: -5
#position_max: 385
[extruder]
step_pin: EBBCan: PD0
dir_pin: !EBBCan: PD1
enable_pin: !EBBCan: PD2
microsteps: 16
rotation_distance: 3.43
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: EBBCan: PB13
sensor_type: EPCOS 100K B57560G104F
sensor_pin: EBBCan: PA3
control: pid
pid_Kp: 14.747
pid_Ki: 0.660
pid_Kd: 82.402
min_temp: 0
max_temp: 300
max_extrude_cross_section: 250
max_extrude_only_distance: 250
### TMC2209 ###
[tmc2209 stepper_x]
uart_pin: PC13
#tx_pin: PE4
#uart_address: 0
run_current: 1.000
stealthchop_threshold: 0
[tmc2209 stepper_y]
uart_pin: PE3
#tx_pin: PE2
#uart_address: 0
run_current: 1.000
stealthchop_threshold: 0
[tmc2209 stepper_z]
uart_pin: PE1
#tx_pin: PE0
#uart_address: 0
run_current: 0.800
stealthchop_threshold: 99999
[tmc2209 stepper_z1]
uart_pin: PD4
#tx_pin: PD2
#uart_address: 0
run_current: 0.800
stealthchop_threshold: 99999
[tmc2209 stepper_z2]
uart_pin: PD1
#tx_pin: PD0
#uart_address: 0
run_current: 0.800
stealthchop_threshold: 99999
[tmc2209 extruder]
uart_pin: EBBCan: PA15
run_current: 0.650
stealthchop_threshold: 99999
### TMC Autotune ###
[autotune_tmc stepper_x]
motor: zyltech-17hd48002h-22b
[autotune_tmc stepper_y]
motor: zyltech-17hd48002h-22b
[autotune_tmc stepper_z]
motor: zyltech-17hd48002h-22b
[autotune_tmc stepper_z1]
motor: zyltech-17hd48002h-22b
[autotune_tmc stepper_z2]
motor: zyltech-17hd48002h-22b
[autotune_tmc extruder]
motor: dfh-14mcrn-1848
### Fan's ###
[fan]
pin: EBBCan: PA0
[heater_fan hotend_fan]
pin: EBBCan: PA1
heater: extruder
heater_temp: 50.0
### BLTouch ###
[bltouch]
sensor_pin: ^EBBCan:PB8
control_pin: EBBCan:PB9
#z_offset: 2.600
stow_on_each_sample: false
probe_with_touch_mode: true
x_offset: 0
y_offset: -34
speed: 10
lift_speed: 20
samples: 2
#sample_retract_distance: 10
samples_tolerance_retries: 4
### Filament Sensor ###
[filament_switch_sensor switch_sensor]
switch_pin: EBBCan:PB4
pause_on_runout: false
runout_gcode: PAUSE
[filament_motion_sensor motion_sensor]
switch_pin: ^EBBCan:PB3
detection_length: 3.0
extruder: extruder
pause_on_runout: false
runout_gcode: PAUSE
### Z Safe Home ###
[safe_z_home]
home_xy_position: 150, 185
speed: 150
z_hop: 10
z_hop_speed: 20
### Z Tilt ###
[z_tilt]
z_positions: 0, 25
300, 25
150, 300
points: 10, 50
280, 50
150, 295
speed: 125
horizontal_move_z: 10
retries: 8
retry_tolerance: 0.01
### Bed Mesh ###
[bed_mesh]
speed: 125
horizontal_move_z: 10
mesh_min: 10, 40
mesh_max: 295,260
probe_count: 5, 5
algorithm: bicubic
bicubic_tension: 0.2
fade_start: 1
fade_end: 10
fade_target: 0
### Temp Sensors ###
[temperature_sensor raspberry_pi]
sensor_type: temperature_host
min_temp: 10
max_temp: 100
[temperature_sensor mcu_temp]
sensor_type: temperature_mcu
min_temp: 0
max_temp: 100
[temperature_sensor EBB_Temperature]
sensor_type: temperature_mcu
sensor_mcu: EBBCan
[temperature_sensor Chamber_Top]
sensor_pin: PF4
sensor_type: NTC 100K MGB18-104F39050L32
min_temp: 0
max_temp: 100
[temperature_sensor Chamber_Bottom]
sensor_pin: PF5
sensor_type: NTC 100K MGB18-104F39050L32
min_temp: 0
max_temp: 100
### Skew Correction ###
[skew_correction]
### Bed Heater ###
[heater_bed]
heater_pin: PB1 #PD12 Changed do to mosfet stuck on
sensor_type: ATC Semitec 104GT-2
sensor_pin: PF3
#control: pid
#pid_Kp: 68.213
#pid_Ki: 0.745
#pid_Kd: 1560.376
min_temp: 0
max_temp: 130
### Input Shaper ###
[adxl345]
cs_pin: EBBCan: PB12
spi_software_sclk_pin: EBBCan: PB10
spi_software_mosi_pin: EBBCan: PB11
spi_software_miso_pin: EBBCan: PB2
axes_map: -x,-y,z
[resonance_tester]
accel_chip: adxl345
probe_points:
150, 150, 375
[input_shaper]
shaper_freq_x: 114.4 # center frequency for the X axis filter
shaper_type_x: ei # filter type for the X axis
shaper_freq_y: 59.2 # center frequency for the Y axis filter
shaper_type_y: mzv # filter type for the Y axis
damping_ratio_x: 0.031 # damping ratio for the X axis
damping_ratio_y: 0.039 # damping ratio for the Y axis
### Neopixel LED's ###
[neopixel neo]
pin: PC9
chain_count: 107
color_order: GRB
initial_RED: 0.5
initial_GREEN: 0.5
initial_BLUE: 0.5
#[neopixel hotend_rgb]
#pin: EBBCan:PD3
### Idle Timeout ###
[idle_timeout]
timeout: 96000
### Macros ###
#[gcode_macro FIRMWARE_RESTART]
#rename_existing: SAFE_RESTART
#gcode:
# G28
# G0 Z375 F2000
# SAVE_CONFIG
[pause_resume]
recover_velocity: 50.
#Genereted with https://config.gab-3d.com/
#
# https://config.gab-3d.com/share/81eb76bf-6ce8-4774-b45e-7d4849658a48
[gcode_macro PRINT_START]
gcode:
{% set BED = params.BED_TEMP|int %}
{% set EXTRUDER = params.EXTRUDER_TEMP|int %}
M140 S{BED} ;Set bed temperature and don't wait
M109 S{EXTRUDER} ;Set extruder temperature and wait
M190 S{BED} ;Set bed temperature and wait
_CHOME ;Home all axes if not homed
_CZTILT ;Z Tilt if not done
BED_MESH_CALIBRATE ;Adaptive Mesh [Auto]
_ADAPTIVE_PURGE ;Adaptive Purge
G90 ;Set to absolute positioning
G92 E0 ;Reset extruder
#SKEW_PROFILE LOAD=default
[gcode_macro _CHOME]
gcode:
{% if printer["gcode_macro status_homing"] != null %}
status_homing
{% endif %}
{% if printer.toolhead.homed_axes != "xyz" %}
G28
{% endif %}
{% if printer["gcode_macro status_ready"] != null %}
status_ready
{% endif %}
[gcode_macro _CZTILT]
gcode:
{% if printer["gcode_macro status_leveling"] != null %}
status_leveling
{% endif %}
{% if printer.z_tilt.applied == False %}
Z_TILT_ADJUST
{% endif %}
{% if printer["gcode_macro status_ready"] != null %}
status_ready
{% endif %}
[gcode_macro M190]
rename_existing: M190.1
gcode:
{% if printer["gcode_macro status_heating"] != null %}
status_heating
{% endif %}
M190.1 { rawparams }
{% if printer["gcode_macro status_ready"] != null %}
status_ready
{% endif %}
[gcode_macro M109]
rename_existing: M109.1
gcode:
{% if printer["gcode_macro status_heating"] != null %}
status_heating
{% endif %}
M109.1 { rawparams }
{% if printer["gcode_macro status_ready"] != null %}
status_ready
{% endif %}
[gcode_macro BED_MESH_CALIBRATE]
rename_existing: _BED_MESH_CALIBRATE
#Insane Version 1.1 - 03-Feb-2023
#Based on https://github.com/kyleisah/Klipper-Adaptive-Meshing-Purging
variable_buffer: 2
gcode:
# Get bed_mesh config (probe count, mesh_min and mesh_max for x and y
{% set bedMeshConfig = printer['configfile'].config["bed_mesh"] %}
{% set bed_mesh_min = bedMeshConfig.mesh_min %}
{% set bed_mesh_max = bedMeshConfig.mesh_max %}
{% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %}
{% set x_min = all_points | map(attribute=0) | min | default(bed_mesh_min[0]) %}
{% set y_min = all_points | map(attribute=1) | min | default(bed_mesh_min[1]) %}
{% set x_max = all_points | map(attribute=0) | max | default(bed_mesh_max[0]) %}
{% set y_max = all_points | map(attribute=1) | max | default(bed_mesh_max[1]) %}
{% if printer["bed_mesh"].profile_name == '' %}
{ action_respond_info("No existing bed mesh found.") }
{% set last_area_end_x=-1 %}
{% endif %}
{% if printer.toolhead.homed_axes != "xyz" %}
G28
{% endif %}
{% set klicky_available = printer['gcode_macro _Probe_Variables'] != null %}
{% set probeConfig = printer['configfile'].config["probe"] %}
{% if probeConfig %}
{% set OffsetX = probeConfig.x_offset|default(0)|float %}
{% set OffsetY = probeConfig.y_offset|default(0)|float %}
{% endif %}
{% set print_min_x = x_min|float %}
{% set print_min_y = y_min|float %}
{% set print_max_x = x_max|float %}
{% set print_max_y = y_max|float %}
{% set mesh_min_x = bed_mesh_min.split(",")[0]|float %}
{% set mesh_min_y = bed_mesh_min.split(",")[1]|float %}
{% set mesh_max_x = bed_mesh_max.split(",")[0]|float %}
{% set mesh_max_y = bed_mesh_max.split(",")[1]|float %}
{% if (print_min_x < mesh_min_x) or (print_max_x > mesh_max_x) or (print_min_y < mesh_min_y) or (print_max_y > mesh_max_y) %}
{% set print_min_x = mesh_min_x %}
{% set print_min_y = mesh_min_y %}
{% set print_max_x = mesh_max_x %}
{% set print_max_y = mesh_max_y %}
{% endif %}
{% if klicky_available %}
_CheckProbe action=query
Attach_Probe
{% elif euclid_available %}
DEPLOY_PROBE
{% endif %}
{% if (print_min_x < print_max_x) and (print_min_y < print_max_y) %}
{% set minimum_probe_count = 3 %}
{% set medium_probe_count = 5 %}
{% set probe_count = bedMeshConfig.probe_count.split(",") %}
{% set probe_count_x = probe_count[0]|int %}
{% if probe_count.__len__() > 1 %}
{% set probe_count_y = probe_count[1]|int %}
{% else %}
{% set probe_count_y = probe_count_x|int %}
{% endif %}
{% set relative_reference_index = bedMeshConfig.relative_reference_index %}
# If print area X is smaller than 75% of the bed size, change to to 5 probe counts for X instead of the default
{% if print_max_x - print_min_x < (mesh_max_x - mesh_min_x) * 0.75 %}
{% set probe_count_x = medium_probe_count %}
{% endif %}
# If print area Y is smaller than 75% of the bed size, change to to 5 probe counts for Y instead of the default
{% if print_max_y - print_min_y < (mesh_max_y - mesh_min_y) * 0.75 %}
{% set probe_count_y = medium_probe_count %}
{% endif %}
# If print area X is smaller than 50% of the bed size, change to to 3 probe counts for X instead of the default
{% if print_max_x - print_min_x < (mesh_max_x - mesh_min_x) * 0.50 %}
{% set probe_count_x = minimum_probe_count %}
{% endif %}
# If print area Y is smaller than 50% of the bed size, change to to 3 probe counts for Y instead of the default
{% if print_max_y - print_min_y < (mesh_max_y - mesh_min_y) * 0.50 %}
{% set probe_count_y = minimum_probe_count %}
{% endif %}
{% if print_min_x - buffer >= mesh_min_x %}
{% set mesh_min_x = print_min_x - buffer %}
{% endif %}
{% if print_min_y - buffer >= mesh_min_y %}
{% set mesh_min_y = print_min_y - buffer %}
{% endif %}
{% if print_max_x + buffer <= mesh_max_x %}
{% set mesh_max_x = print_max_x + buffer %}
{% endif %}
{% if print_max_y + buffer <= mesh_max_y %}
{% set mesh_max_y = print_max_y + buffer %}
{% endif %}
{ action_respond_info("mesh_min: %s,%s" % (mesh_min_x, mesh_min_y)) }
{ action_respond_info("mesh_max: %s,%s" % (mesh_max_x, mesh_max_y)) }
{ action_respond_info("probe_count: %s,%s" % (probe_count_x,probe_count_y)) }
{% if printer["gcode_macro status_meshing"] != null %}
status_meshing
{% endif %}
{% if relative_reference_index == 0 or relative_reference_index == null %}
_BED_MESH_CALIBRATE mesh_min={mesh_min_x},{mesh_min_y} mesh_max={mesh_max_x},{mesh_max_y} probe_count={probe_count_x},{probe_count_y}
{% else %}
{% set relative_reference_index = ((probe_count_x * probe_count_y - 1) / 2)|int %}
{ action_respond_info("relative_reference_index: %s" % relative_reference_index) }
_BED_MESH_CALIBRATE mesh_min={mesh_min_x},{mesh_min_y} mesh_max={mesh_max_x},{mesh_max_y} probe_count={probe_count_x},{probe_count_y} relative_reference_index={relative_reference_index}
{% endif %}
{% else %}
{% if printer["gcode_macro status_meshing"] != null %}
status_meshing
{% endif %}
_BED_MESH_CALIBRATE
{% endif %}
{% if klicky_available %}
Dock_Probe
{% elif euclid_available %}
STOW_PROBE
{% endif %}
{% if printer["gcode_macro status_ready"] != null %}
status_ready
{% endif %}
# # # Klipper Adaptive Purging - VoronDesign Logo # # #
# credits: https://github.com/kyleisah/Klipper-Adaptive-Meshing-Purging/blob/main/Configuration/Adaptive_Purge.cfg
# credits: Insane Version 1.1 - 03-Feb-2023
[gcode_macro _ADAPTIVE_PURGE]
description: A purge macro that adapts to be near your actual printed objects
variable_adaptive_enable: True # Change to False if you'd like the purge to be in the same spot every print
variable_z_height: 0.4 # Height above the bed to purge
variable_tip_distance: 10 # Distance between filament tip and nozzle before purge (this will require some tuning)
variable_purge_amount: 40 # Amount of filament to purge
variable_flow_rate: 10 # Desired flow rate in mm3/s
variable_x_default: 5 # X location to purge, overwritten if adaptive is True
variable_y_default: 5 # Y location to purge, overwritten if adaptive is True
variable_size: 10 # Size of the logo
variable_distance_to_object_x: 5 # Distance in x to the print area
variable_distance_to_object_y: 5 # Distance in y to the print area
gcode:
{% if adaptive_enable == True %}
{% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %}
{% set x_origin = (all_points | map(attribute=0) | min | default(x_default + distance_to_object_x + size)) - distance_to_object_x - size %}
{% set y_origin = (all_points | map(attribute=1) | min | default(y_default + distance_to_object_y + size)) - distance_to_object_y - size %}
{% set x_origin = ([x_origin, 0] | max) %}
{% set y_origin = ([y_origin, 0] | max) %}
{% if x_origin < x_default %}
set x_origin = x_default | float
{% endif %}
{% if y_origin < y_default %}
set y_origin = y_default | float
{% endif %}
{% else %}
{% set x_origin = x_default | float %}
{% set y_origin = y_default | float %}
{% endif %}
{% set purge_move_speed = 2.31 * size * flow_rate / (purge_amount * 2.405) %}
{% set prepurge_speed = flow_rate / 2.405 %}
{% set travel_speed = printer.toolhead.max_velocity %}
{ action_respond_info( "x: " + x_origin|string + " y: " + y_origin|string + " purge_move_speed: " + purge_move_speed|string + " prepurge_speed: " + prepurge_speed|string ) }
G92 E0
G0 F{travel_speed*5} # Set travel speed
G90 # Absolute positioning
G0 X{x_origin} Y{y_origin+size/2} # Move to purge position
G0 Z{z_height} # Move to purge Z height
M83 # Relative extrusion mode
G1 E{tip_distance} F{prepurge_speed*60} # Move tip of filament to nozzle
G1 X{x_origin+size*0.289} Y{y_origin+size} E{purge_amount/4} F{purge_move_speed*60} # Purge first line of logo
G1 E-.5 F2100 # Retract
G0 Z{z_height*2} # Z hop
G0 X{x_origin+size*0.789} Y{y_origin+size} # Move to second purge line origin
G0 Z{z_height} # Move to purge Z height
G1 E.5 F2100 # Recover
G1 X{x_origin+size*0.211} Y{y_origin} E{purge_amount/2} F{purge_move_speed*60} # Purge second line of logo
G1 E-.5 F2100 # Retract
G0 Z{z_height*2} # Z hop
G0 X{x_origin+size*0.711} Y{y_origin} # Move to third purge line origin
G0 Z{z_height} # Move to purge Z height
G1 E.5 F2100 # Recover
G1 X{x_origin+size} Y{y_origin+size/2} E{purge_amount/4} F{purge_move_speed*60} # Purge third line of logo
G1 E-.5 F2100 # Retract
G92 E0 # Reset extruder distance
M82 # Absolute extrusion mode
G0 Z{z_height*2} # Z hop
{% if printer["gcode_macro status_printing"] != null %}
status_printing
{% endif %}
[exclude_object]
[pause_resume]
recover_velocity: 300.0
#From mainsail macro
[gcode_macro PAUSE]
rename_existing: PAUSE_BASE
gcode:
PAUSE_BASE
_TOOLHEAD_PARK_PAUSE_CANCEL
{% if printer["gcode_macro status_busy"] != null %}
status_busy
{% endif %}
#From mainsail macro
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### read extrude from _TOOLHEAD_PARK_PAUSE_CANCEL macro #####
{% set extrude = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
M83
G1 E{extrude} F2100
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
{% if printer["gcode_macro status_printing"] != null %}
status_printing
{% endif %}
#From mainsail macro
[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
variable_extrude: 1.0
gcode:
##### set park positon for x and y #####
# default is your max posion from your printer.cfg
{% set x_park = printer.toolhead.axis_maximum.x|float / 2 %}
{% set y_park = printer.toolhead.axis_maximum.y %}
{% set z_park_delta = 2.0 %}
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - z_park_delta) %}
{% set z_safe = z_park_delta %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
M83
G1 E-{extrude} F2100
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G91
G1 Z{z_safe} F900
G90
G1 X{x_park} Y{y_park} F6000
{% if printer.gcode_move.absolute_coordinates|lower == 'false' %} G91 {% endif %}
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
{% if printer["gcode_macro status_ready"] != null %}
status_ready
{% endif %}
[gcode_macro PRINT_END]
gcode:
TURN_OFF_HEATERS ;Turn off heaters
M106 S0 ;Part cooling fan speed
G1 E-.5 F120 ;Retract filament
_MOVE_AWAY ;Move away from print
G0 Z375 F3000 ;Move Up
PARK_CENTER_REAR ;Park central rear
#SET_SKEW CLEAR=1
[gcode_macro _MOVE_AWAY]
gcode:
{% set th = printer.toolhead %}
{% set x_safe = th.position.x + 20 * (1 if th.axis_maximum.x - th.position.x > 20 else -1) %}
{% set y_safe = th.position.y + 20 * (1 if th.axis_maximum.y - th.position.y > 20 else -1) %}
{% set z_safe = [th.position.z + 2, th.axis_maximum.z]|min %}
G90 ; absolute positioning
G0 X{x_safe} Y{y_safe} Z{z_safe} F20000 ; move nozzle to remove stringing
[gcode_macro PARK_CENTER_REAR]
gcode:
{% if printer["gcode_macro status_busy"] != null %}
status_busy
{% endif %}
{% set th = printer.toolhead %}
{% set x_safe = th.position.x + 20 * (1 if th.axis_maximum.x - th.position.x > 20 else -1) %}
{% set y_safe = th.position.y + 20 * (1 if th.axis_maximum.y - th.position.y > 20 else -1) %}
G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y - 2} F3600
{% if printer["gcode_macro status_ready"] != null %}
status_ready
{% endif %}
# Home, get position, throw around toolhead, home again.
# If MCU stepper positions (first line in GET_POSITION) are greater than a full step different (your number of microsteps), then skipping occured.
# We only measure to a full step to accomodate for endstop variance.
# Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10
[gcode_macro TEST_SPEED]
gcode:
# Speed
{% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %}
# Iterations
{% set iterations = params.ITERATIONS|default(5)|int %}
# Acceleration
{% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %}
# Bounding inset for large pattern (helps prevent slamming the toolhead into the sides after small skips, and helps to account for machines with imperfectly set dimensions)
{% set bound = params.BOUND|default(20)|int %}
# Size for small pattern box
{% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %}
# Large pattern
# Max positions, inset by BOUND
{% set x_min = printer.toolhead.axis_minimum.x + bound %}
{% set x_max = printer.toolhead.axis_maximum.x - bound %}
{% set y_min = printer.toolhead.axis_minimum.y + bound %}
{% set y_max = printer.toolhead.axis_maximum.y - bound %}
# Small pattern at center
# Find X/Y center point
{% set x_center = (printer.toolhead.axis_minimum.x|float + printer.toolhead.axis_maximum.x|float ) / 2 %}
{% set y_center = (printer.toolhead.axis_minimum.y|float + printer.toolhead.axis_maximum.y|float ) / 2 %}
# Set small pattern box around center point
{% set x_center_min = x_center - (smallpatternsize/2) %}
{% set x_center_max = x_center + (smallpatternsize/2) %}
{% set y_center_min = y_center - (smallpatternsize/2) %}
{% set y_center_max = y_center + (smallpatternsize/2) %}
# Save current gcode state (absolute/relative, etc)
SAVE_GCODE_STATE NAME=TEST_SPEED
# Output parameters to g-code terminal
{ action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) }
# Home and get position for comparison later:
M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66
G28
# QGL if not already QGLd (only if QGL section exists in config)
{% if printer.configfile.settings.quad_gantry_level %}
{% if printer.quad_gantry_level.applied == False %}
QUAD_GANTRY_LEVEL
G28 Z
{% endif %}
{% endif %}
# Move 50mm away from max position and home again (to help with hall effect endstop accuracy - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/24)
G90
G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{30*60}
M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66
G28 X Y
G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60}
G4 P1000
GET_POSITION
# Go to starting position
G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60}
# Set new limits
SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2}
{% for i in range(iterations) %}
# Large pattern diagonals
G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_max} Y{y_max} F{speed*60}
G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}
G0 X{x_min} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}
# Large pattern box
G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_min} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}
# Small pattern diagonals
G0 X{x_center_min} Y{y_center_min} F{speed*60}
G0 X{x_center_max} Y{y_center_max} F{speed*60}
G0 X{x_center_min} Y{y_center_min} F{speed*60}
G0 X{x_center_max} Y{y_center_min} F{speed*60}
G0 X{x_center_min} Y{y_center_max} F{speed*60}
G0 X{x_center_max} Y{y_center_min} F{speed*60}
# Small patternbox
G0 X{x_center_min} Y{y_center_min} F{speed*60}
G0 X{x_center_min} Y{y_center_max} F{speed*60}
G0 X{x_center_max} Y{y_center_max} F{speed*60}
G0 X{x_center_max} Y{y_center_min} F{speed*60}
{% endfor %}
# Restore max speed/accel/accel_to_decel to their configured values
SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel}
# Re-home and get position again for comparison:
M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66
G28 # This is a full G28 to fix an issue with CoreXZ - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/12
# Go to XY home positions (in case your homing override leaves it elsewhere)
G90
G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60}
G4 P1000
GET_POSITION
# Restore previous gcode state (absolute/relative, etc)
RESTORE_GCODE_STATE NAME=TEST_SPEED
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value
CLEAR_PAUSE
SDCARD_RESET_FILE
PRINT_END
BASE_CANCEL_PRINT
[gcode_macro FILAMENT_UNLOAD]
gcode:
M83 # Put the extruder into relative mode
G92 E0.0 # Reset the extruder so that it thinks it is at position zero
G1 E-75 F350 # Move the extruder reverse 75mm at a speed of 350mm/minute
G92 E0.0 # Reset the extruder again
M82 # Put the extruder back into absolute mode.
[gcode_macro FILAMENT_LOAD]
gcode:
M83 # Put the extruder into relative mode
G92 E0.0 # Reset the extruder so that it thinks it is at position zero
G1 E75 F350 # Move the extruder forward 75mm at a speed of 350mm/minute
G92 E0.0 # Reset the extruder again
M82 # Put the extruder back into absolute mode.
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 56.384
#*# pid_ki = 2.320
#*# pid_kd = 342.530
#*#
#*# [bltouch]
#*# z_offset = 1.145
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 0.128684, 0.218684, 0.183684
#*# 0.058684, 0.138684, 0.158684
#*# 0.048684, 0.113684, 0.118684
#*# -0.011316, 0.078684, 0.083684
#*# -0.041316, 0.048684, 0.068684
#*# x_count = 3
#*# y_count = 5
#*# mesh_x_pps = 2
#*# mesh_y_pps = 2
#*# algo = lagrange
#*# tension = 0.2
#*# min_x = 115.05
#*# max_x = 174.93
#*# min_y = 84.48
#*# max_y = 205.52
#*#
#*# [skew_correction default]
#*# xy_skew = -0.0012863213127576173
#*# xz_skew = 0.0031993296215198845
#*# yz_skew = -0.003485955136681875