-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathM701.cfg
41 lines (38 loc) · 1.35 KB
/
M701.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
# See: https://reprap.org/wiki/G-code#M701:_Load_filament
[gcode_macro M701]
description: Load filament compatible command
gcode:
# Setup fallback defaults
{% set default_u = 100 %}
# Try load bowden tube length from saved variables
{% if 'save_variables' in printer %}
{% set svv = printer.save_variables.variables %}
{% if 'bowden_length' in svv %}
{% set default_u = svv.bowden_length %}
{% endif %}
{% endif %}
# Get command parameters
{% set i = params.I|default(30)|float %}
{% set i_f = params.IF|default(180)|float %}
{% set u = params.U|default(default_u)|float %}
{% set u_f = params.UF|default(360)|float %}
{% set p = params.P|default(30)|float %}
{% set p_f = params.PF|default(180)|float %}
{% if printer.idle_timeout.state == "Printing" and not printer.pause_resume.is_paused %}
{action_respond_info("This command cannot be used while printing")}
{% elif printer.extruder.temperature < 170 %}
{action_respond_info("Extruder temperature too low")}
{% else %}
SAVE_GCODE_STATE NAME=M701_state
M83
{% if i > 0.0 %}
G1 E{i} F{i_f}
{% endif %}
{% if u > 0.0 %}
G1 E{u} F{u_f}
{% endif %}
{% if p > 0.0 %}
G1 E{p} F{p_f}
{% endif %}
RESTORE_GCODE_STATE NAME=M701_state MOVE=0
{% endif %}