forked from victor-chew/klipper-pa-lines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pa_macro.cfg
75 lines (68 loc) · 3.77 KB
/
pa_macro.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
# Pressure Advance test macro by drawing 20 simple lines
#
# Adapted from: https://www.reddit.com/r/VORONDesign/comments/sjdiol/pressure_advance_testing_macro_klipper/
# to suit home-made free ABL that requires a pause after homing to manually retract the probe.
#
# To do that, the process is divided into 2 macros:
#
# - PA_INIT to bring bed and extruder up to temperature, then home.
# eg. PA_INIT BED_TEMP=65 EXTRUDER_TEMP=205
# After homing, the ABL can be manually retracted
#
# - PA_CAL to start the Pressure Advance test.
# eg. PA_CAL PA_START=0.01 PA_STEP=0.01 NZL=0.4
# This will draw 20 lines using different PA values
#
# To use, simply include in printer.cfg:
#
# [include pa_macro.cfg]
[gcode_macro PA_INIT]
gcode:
{% set BED_TEMP = params.BED_TEMP|default(60)|float %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %}
M140 S{BED_TEMP} ;Start heating bed
M190 S{BED_TEMP} ;Wait for bed to reach temp before proceeding
M104 S{EXTRUDER_TEMP} ;Start heating extruder
M109 S{EXTRUDER_TEMP} ;Wait for extruder to reach temp before proceeding
G28 ;Home all axes and pause with audio alert
[gcode_macro PA_CAL]
gcode:
{% set PA_START = params.PA_START|default(0.0)|float %}
{% set PA_STEP = params.PA_STEP|default(0.005)|float %}
{% set NZL_CFG = printer.configfile.config["extruder"]["nozzle_diameter"]|float %}
{% set NZL = params.NZL|default(NZL_CFG)|float %}
{% set E5 = (0.1147475 * NZL) * 5|float %}
{% set E20 = (0.1147475 * NZL) * 20|float %}
{% set E40 = (0.1147475 * NZL) * 40|float %}
{% set X_MID = printer.configfile.config["stepper_x"]["position_max"]|float / 2.0 %}
{% set Y_MID = printer.configfile.config["stepper_y"]["position_max"]|float / 2.0 %}
G21 ; millimeter units
G90 ; absolute XYZ
M83 ; relative E
SET_VELOCITY_LIMIT ACCEL=3000 ACCEL_TO_DECEL=1500
G92 E0 ; reset extruder
M106 S0 ; set fan speed to zero
; This was taken from Cura to prime the extruder by tracing a line at the
; left side of the build bed twice
G1 X10.1 Y20 Z0.28 F5000.0 ; move to start position
G1 X10.1 Y200.0 Z0.28 F1500.0 E15 ; draw the first line
G1 X10.4 Y200.0 Z0.28 F5000.0 ; move to side a little
G1 X10.4 Y20 Z0.28 F1500.0 E30 ; draw the second line
G1 E-2 F1800 ; retract
G1 Z5 F300 ; move above layer height
{% for i in range(0, 20) %}
SET_PRESSURE_ADVANCE ADVANCE={PA_START + (i * PA_STEP)} ; set Pressure Advance
M117 Testing Pressure Advance at: {PA_START + (i * PA_STEP)}
G1 X{(X_MID-40)} Y{(Y_MID-35)+(5*i)} F5000 ; move to start position
G1 Z0.2 F300 ; move to layer height
G1 E2 F1800 ; un-retract
G1 X{(X_MID-20)} Y{(Y_MID-35)+(5*i)} E{E20} F300 ; print line part one
G1 X{(X_MID+20)} Y{(Y_MID-35)+(5*i)} E{E40} F9000 ; print line part two
G1 X{(X_MID+40)} Y{(Y_MID-35)+(5*i)} E{E20} F300 ; print line part three
G1 E-2 F1800 ; retract
G1 Z5 F300 ; move above layer height
{% endfor %}
; This was again taken from Cura to raise the extruder and push the build plate forward when test is done
G1 Z20 F300 ; Raise Z more
G1 X{X_MID} Y{(Y_MID-35)+(5*24)} F300 ; Present print by pushing build plate forward a little
M117 Find best line and multiply it by ({PA_START} + (line * {PA_STEP}) ) to find your PA setting.