forked from tyrscgm/Demon_KLIPPER_Essentials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemon_adaptive_pa_v1.0.cfg
232 lines (178 loc) · 10.5 KB
/
demon_adaptive_pa_v1.0.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
###################################################
#######>>>>>>>>>> 3DPrintDemon <<<<<<<<<<<#######
####### https://github.com/3DPrintDemon #######
# IF YOU USE & LIKE THESE MACROS PLEASE CONSIDER SUPPORTING MY EFFORTS AT
# https://ko-fi.com/3dprintdemon
[gcode_macro _ADAPTIVE_PA]
gcode:
{% set ext_type = params.TYPE|string %}
{% set start_vars = printer["gcode_macro _START_VARIABLES"] %}
{% set apa_vars = printer["gcode_macro _APA_VARS"] %}
{% if apa_vars.enable == True %}
{% if ext_type == "Perimeter" and apa_vars.prmtr > 0 %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="PA change APA setting Inner Wall {apa_vars.prmtr}"
{% endif %}
SET_PRESSURE_ADVANCE ADVANCE={apa_vars.prmtr}
{% elif ext_type == "Perimeter" and apa_vars.prmtr == 0 %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="PA change default setting Inner Wall {apa_vars.default}"
{% endif %}
SET_PRESSURE_ADVANCE ADVANCE={apa_vars.default}
{% elif ext_type == "ExternalPerimeter" and apa_vars.ext_prmtr > 0 %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="PA change APA setting Outer wall {apa_vars.ext_prmtr}"
{% endif %}
SET_PRESSURE_ADVANCE ADVANCE={apa_vars.ext_prmtr}
{% elif ext_type == "ExternalPerimeter" and apa_vars.ext_prmtr == 0 %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="PA change default setting Outer wall {apa_vars.default}"
{% endif %}
SET_PRESSURE_ADVANCE ADVANCE={apa_vars.default}
{% elif ext_type == "InternalInfill" and apa_vars.infill > 0 %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="PA change APA setting Sparse infill {apa_vars.infill}"
{% endif %}
SET_PRESSURE_ADVANCE ADVANCE={apa_vars.infill}
{% elif ext_type == "InternalInfill" and apa_vars.infill == 0 %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="PA change default setting Sparse infill {apa_vars.default}"
{% endif %}
SET_PRESSURE_ADVANCE ADVANCE={apa_vars.default}
{% elif ext_type == "SolidInfill" and apa_vars.sld_infill > 0 %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="PA change APA setting Internal solid infill {apa_vars.sld_infill}"
{% endif %}
SET_PRESSURE_ADVANCE ADVANCE={apa_vars.sld_infill}
{% elif ext_type == "SolidInfill" and apa_vars.sld_infill == 0 %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="PA change default setting Internal solid infill {apa_vars.default}"
{% endif %}
SET_PRESSURE_ADVANCE ADVANCE={apa_vars.default}
{% elif ext_type == "TopSolidInfill" and apa_vars.top_srfc > 0 %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="PA change APA setting Top surface {apa_vars.top_srfc}"
{% endif %}
SET_PRESSURE_ADVANCE ADVANCE={apa_vars.top_srfc}
{% elif ext_type == "TopSolidInfill" and apa_vars.top_srfc == 0 %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="PA change default setting Top surface {apa_vars.default}"
{% endif %}
SET_PRESSURE_ADVANCE ADVANCE={apa_vars.default}
{% elif ext_type not in ["Perimeter", "ExternalPerimeter", "InternalInfill", "SolidInfill", "TopSolidInfill"] %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="PA change default setting for other extrusion types {apa_vars.default}"
{% endif %}
SET_PRESSURE_ADVANCE ADVANCE={apa_vars.default}
{% endif %}
{% endif %}
[gcode_macro _APA_VARS]
variable_default: 0
variable_prmtr: 0
variable_ext_prmtr: 0
variable_infill: 0
variable_sld_infill: 0
variable_top_srfc: 0
variable_fil_type: "PLA"
variable_enable: False
gcode:
[gcode_macro _APA_SET]
gcode:
{% set start_vars = printer["gcode_macro _START_VARIABLES"] %}
{% set apa_vars = printer["gcode_macro _APA_VARS"] %}
{% if apa_vars.fil_type == 'PLA' and start_vars.pla_adaptive_pa_enable == True %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="Setting system for PLA APA"
{% endif %}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=enable VALUE=True
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=default VALUE={start_vars.pla_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=prmtr VALUE={start_vars.pla_inner_wall_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=ext_prmtr VALUE={start_vars.pla_outer_wall_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=infill VALUE={start_vars.pla_sparse_infill_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=sld_infill VALUE={start_vars.pla_solid_infill_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=top_srfc VALUE={start_vars.pla_top_surface_pa|float}
_APA_READ
{% elif apa_vars.fil_type == 'ASA' and start_vars.asa_adaptive_pa_enable == True %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="Setting system for ASA APA"
{% endif %}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=enable VALUE=True
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=default VALUE={start_vars.asa_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=prmtr VALUE={start_vars.asa_inner_wall_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=ext_prmtr VALUE={start_vars.asa_outer_wall_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=infill VALUE={start_vars.asa_sparse_infill_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=sld_infill VALUE={start_vars.asa_solid_infill_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=top_srfc VALUE={start_vars.asa_top_surface_pa|float}
_APA_READ
{% elif apa_vars.fil_type == 'ABS' and start_vars.abs_adaptive_pa_enable == True %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="Setting system for ABS APA"
{% endif %}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=enable VALUE=True
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=default VALUE={start_vars.abs_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=prmtr VALUE={start_vars.abs_inner_wall_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=ext_prmtr VALUE={start_vars.abs_outer_wall_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=infill VALUE={start_vars.abs_sparse_infill_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=sld_infill VALUE={start_vars.abs_solid_infill_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=top_srfc VALUE={start_vars.abs_top_surface_pa|float}
_APA_READ
{% elif apa_vars.fil_type == 'PETG' and start_vars.petg_adaptive_pa_enable == True %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="Setting system for PETG APA"
{% endif %}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=enable VALUE=True
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=default VALUE={start_vars.petg_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=prmtr VALUE={start_vars.petg_inner_wall_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=ext_prmtr VALUE={start_vars.petg_outer_wall_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=infill VALUE={start_vars.petg_sparse_infill_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=sld_infill VALUE={start_vars.petg_solid_infill_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=top_srfc VALUE={start_vars.petg_top_surface_pa|float}
_APA_READ
{% elif apa_vars.fil_type == 'TPU' and start_vars.tpu_adaptive_pa_enable == True %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="Setting system for TPU APA"
{% endif %}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=enable VALUE=True
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=default VALUE={start_vars.tpu_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=prmtr VALUE={start_vars.tpu_inner_wall_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=ext_prmtr VALUE={start_vars.tpu_outer_wall_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=infill VALUE={start_vars.tpu_sparse_infill_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=sld_infill VALUE={start_vars.tpu_solid_infill_pa|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=top_srfc VALUE={start_vars.tpu_top_surface_pa|float}
_APA_READ
{% elif apa_vars.fil_type not in ["PLA", "ASA", "ABS", "PETG", "TPU"] %}
{% if start_vars.apa_readback_enable == True %}
RESPOND TYPE=COMMAND MSG="Unlisted filament file detected. SWITCHING APA OFF"
{% endif %}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=enable VALUE=False
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=default VALUE={printer.configfile.settings.extruder.pressure_advance|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=prmtr VALUE=0
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=ext_prmtr VALUE=0
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=infill VALUE=0
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=sld_infill VALUE=0
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=top_srfc VALUE=0
_APA_READ
{% else %}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=enable VALUE=False
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=default VALUE={printer.configfile.settings.extruder.pressure_advance|float}
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=prmtr VALUE=0
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=ext_prmtr VALUE=0
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=infill VALUE=0
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=sld_infill VALUE=0
SET_GCODE_VARIABLE MACRO=_APA_VARS VARIABLE=top_srfc VALUE=0
_APA_READ
{% endif %}
[gcode_macro _APA_READ]
gcode:
{% set read_vars = printer["gcode_macro _APA_VARS"] %}
RESPOND TYPE=COMMAND MSG="APA default {read_vars.default}"
RESPOND TYPE=COMMAND MSG="APA prmtr {read_vars.prmtr}"
RESPOND TYPE=COMMAND MSG="APA ext_prmtr {read_vars.ext_prmtr}"
RESPOND TYPE=COMMAND MSG="APA infill {read_vars.infill}"
RESPOND TYPE=COMMAND MSG="APA sld_infill {read_vars.sld_infill}"
RESPOND TYPE=COMMAND MSG="APA top_srfc {read_vars.top_srfc}"
RESPOND TYPE=COMMAND MSG="APA fil_type {read_vars.fil_type}"
RESPOND TYPE=COMMAND MSG="APA enable {read_vars.enable}"
[gcode_macro _AP_VERSION_VARIABLES]
variable_demon_apa: 1.0
gcode: