-
Notifications
You must be signed in to change notification settings - Fork 9
/
M600.cfg
52 lines (49 loc) · 1.81 KB
/
M600.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
# WIP
# Usage:
# M600 [X<num>] [Y<num>] [Z<mum>] [E<num>] [L<num>] [N]
# X: position
# Y: position
# Z: relative lift distance
# E: initial retract
# L: later retract distance for removal
# N: (no return) Don't return to the previous position after filament change
# See: https://reprap.org/wiki/G-code#M600:_Filament_change_pause
[gcode_macro M600]
description: Filament change pause (Klipper compatible G-code)
gcode:
{% set default_x = printer.toolhead.axis_minimum.x + 20 %}
{% set default_y = printer.toolhead.axis_minimum.y + 20 %}
{% set default_e = 100 %}
{% if 'save_variables' in printer %}
{% set svv = printer.save_variables.variables %}
{% if 'park_x' in svv %}
{% set default_x = svv.park_x %}
{% endif %}
{% if 'park_y' in svv %}
{% set default_y = svv.park_y %}
{% endif %}
{% if 'bowden_length' in svv %}
{% set default_e = svv.bowden_length %}
{% endif %}
{% endif %}
{% set x = params.X|default(default_x)|float %}
{% set y = params.Y|default(default_y)|float %}
{% set z = params.Z|default(20)|float %}
{% set e = params.E|default(default_e)|float %}
{% if printer.pause_resume.is_paused %}
{action_respond_info("Already paused")}
{% elif printer.toolhead.homed_axes != "xyz" %}
{action_respond_info("Please home XYZ first")}
{% else %}
{% if params.N is not defined %}
SAVE_GCODE_STATE NAME=M600_state
PAUSE_PARK X={x} Y={y} Z={z}
M702 U{e}
RESTORE_GCODE_STATE NAME=M600_state MOVE=1
{% else %}
SAVE_GCODE_STATE NAME=M600_state
PAUSE_PARK X={x} Y={y} Z={z}
M702 U{e}
RESTORE_GCODE_STATE NAME=M600_state MOVE=0
{% endif %}
{% endif %}