-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtest_probe_accuracy.cfg
130 lines (112 loc) · 6.36 KB
/
test_probe_accuracy.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
# run
# ~/plotly-env/bin/python3 ~/probe_accuracy/probe_accuracy.py --klippy-uds ./printer_data/comms/moonraker.sock
#in SSH session.
# then run TEST_PROBE_ACCURACY in Mainsail/Fluidd. It takes an hour.
# to plot existing json data:
# ~/plotly-env/bin/python3 ~/probe_accuracy/probe_accuracy.py \
# --plot-only \
# --data-file /tmp/probe_accuracy.json \
# --chart-file /tmp/probe_accuracy.html
[gcode_macro TEST_PROBE_ACCURACY]
# Continuously run PROBE_ACCURACY while:
# - idling for START_IDLE_MINUTES
# - heating the bed to BED_TEMP
# - once at BED_TEMP, letting the bed soak for BED_SOAK_MINUTES
# - with the bed still on, heating the extruder to EXTRUDER_TEMP
# - once at EXTRUDER_TEMP, letting the extruder soak for EXTRUDER_SOAK_MINUTES
# - turning off the heaters, and idling for END_IDLE_MINUTES
variable_start_idle_minutes: 0
variable_bed_temp: 0
variable_extruder_temp: 0
variable_bed_soak_minutes: 0
variable_extruder_soak_minutes: 0
variable_dwell_seconds: 0
variable_dwell_lift_z: 0
variable_end_idle_minutes: 0
variable_state: 'start'
variable_next_state: 'none'
gcode:
# Copy parameters into gcode variables.
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=start_idle_minutes VALUE={ params.START_IDLE_MINUTES|default(5)|int }
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=bed_temp VALUE={ params.BED_TEMP|default(110)|int }
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=extruder_temp VALUE={ params.EXTRUDER_TEMP|default(150)|int }
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=bed_soak_minutes VALUE={ params.BED_SOAK_MINUTES|default(30)|int }
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=extruder_soak_minutes VALUE={ params.EXTRUDER_SOAK_MINUTES|default(15)|int }
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=dwell_seconds VALUE={ params.DWELL_SECONDS|default(1)|int }
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=dwell_lift_z VALUE={ params.DWELL_LIFT_Z|default(-1)|int }
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=end_idle_minutes VALUE={ params.END_IDLE_MINUTES|default(10)|int }
# Initialize state variables in case they have old values from last run.
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=state VALUE='"start"'
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=next_state VALUE='"none"'
# Schedule main loop.
UPDATE_DELAYED_GCODE ID=probe_accuracy_loop DURATION=1
[delayed_gcode probe_accuracy_loop]
gcode:
{% set tmacro = printer['gcode_macro TEST_PROBE_ACCURACY'] %}
{% if tmacro.state == 'start' %}
{ action_respond_info('TEST_PROBE_ACCURACY: START') }
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=state VALUE='"start_idle"'
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=next_state VALUE='"start_idle_done"'
UPDATE_DELAYED_GCODE ID=probe_accuracy_set_next_state DURATION={ tmacro.start_idle_minutes|int * 60 }
{% elif tmacro.state == 'start_idle_done' %}
{% if tmacro.bed_temp >= 0 %}
M140 S{ tmacro.bed_temp }
{ action_respond_info('TEST_PROBE_ACCURACY: BED HEATING TO %s' % tmacro.bed_temp) }
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=state VALUE='"bed_heating"'
{% else %}
# Skip heating and soaking the bed, go directly to bed_soaked state.
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=state VALUE='"bed_soaked"'
{% endif %}
{% elif tmacro.state == 'bed_heating' %}
{% if printer.heater_bed.temperature >= tmacro.bed_temp %}
{ action_respond_info('TEST_PROBE_ACCURACY: BED HEATED TO %s' % tmacro.bed_temp) }
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=state VALUE='"bed_soaking"'
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=next_state VALUE='"bed_soaked"'
UPDATE_DELAYED_GCODE ID=probe_accuracy_set_next_state DURATION={ tmacro.bed_soak_minutes|int * 60 }
{% endif %}
{% elif tmacro.state == 'bed_soaked' %}
{% if tmacro.bed_temp >= 0 %}
{ action_respond_info('TEST_PROBE_ACCURACY: BED SOAKED') }
{% endif %}
{% if tmacro.extruder_temp >= 0 %}
M104 S{ tmacro.extruder_temp }
{ action_respond_info('TEST_PROBE_ACCURACY: EXTRUDER HEATING TO %s' % tmacro.extruder_temp) }
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=state VALUE='"extruder_heating"'
{% else %}
# Skip heating and soaking the extruder, go directly to extruder_soaked state.
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=state VALUE='"extruder_soaked"'
{% endif %}
{% elif tmacro.state == 'extruder_heating' %}
{% if printer.extruder.temperature >= tmacro.extruder_temp %}
{ action_respond_info('TEST_PROBE_ACCURACY: EXTRUDER HEATED TO %s' % tmacro.extruder_temp) }
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=state VALUE='"extruder_soaking"'
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=next_state VALUE='"extruder_soaked"'
UPDATE_DELAYED_GCODE ID=probe_accuracy_set_next_state DURATION={ tmacro.extruder_soak_minutes|int * 60 }
{% endif %}
{% elif tmacro.state == 'extruder_soaked' %}
{% if tmacro.extruder_temp >= 0 %}
{ action_respond_info('TEST_PROBE_ACCURACY: EXTRUDER SOAKED') }
{% endif %}
TURN_OFF_HEATERS
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=state VALUE='"end_idle"'
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=next_state VALUE='"done"'
UPDATE_DELAYED_GCODE ID=probe_accuracy_set_next_state DURATION={ tmacro.end_idle_minutes|int * 60 }
{% elif tmacro.state == 'done' %}
{ action_respond_info('TEST_PROBE_ACCURACY: DONE') }
G90
G1 Z30
UPDATE_DELAYED_GCODE ID=probe_accuracy_loop DURATION=0
{% endif %}
{% if tmacro.state != 'done' %}
M105
PROBE_ACCURACY
{% if tmacro.dwell_lift_z >= 0 %}
G1 Z{ tmacro.dwell_lift_z }
{% endif %}
M400
UPDATE_DELAYED_GCODE ID=probe_accuracy_loop DURATION={ tmacro.dwell_seconds }
{% endif %}
[delayed_gcode probe_accuracy_set_next_state]
gcode:
{% set tmacro = printer['gcode_macro TEST_PROBE_ACCURACY'] %}
SET_GCODE_VARIABLE MACRO=TEST_PROBE_ACCURACY VARIABLE=state VALUE='"{ tmacro.next_state }"'