-
Notifications
You must be signed in to change notification settings - Fork 4
/
kiauh_macros.cfg
75 lines (71 loc) · 2.54 KB
/
kiauh_macros.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
[pause_resume]
[display_status]
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
TIMELAPSE_END
{% set z_lift = params.Z_LIFT|default(10)|float %}
{% set extrude_speed = params.E_SPEED|default(40)|float %}
##### read E from pause macro #####
{% set e = printer["gcode_macro PAUSE"].extrude|float %}
{% set x_park = printer.toolhead.axis_minimum.x|float + 10 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 10 %}
{% set travel_speed = printer.toolhead.max_velocity|int %}
{% set z_speed = printer.configfile.config['printer'].max_z_velocity|int %}
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.gcode_move.gcode_position.z|float %}
{% if act_z < (max_z - 2.0) %}
{% set z_safe = act_z + 2.0 %}
{% else %}
{% set z_safe = max_z %}
{% endif %}
##### end of definitions #####
G1 E-{e} F{extrude_speed * 60}
TURN_OFF_HEATERS
M107 ; turn off fan
G1 z{z_safe} F{z_speed * 60}
G1 X{x_park} Y{y_park} F{travel_speed * 60}
CLEAR_PAUSE
SDCARD_RESET_FILE
BASE_CANCEL_PRINT
TIMELAPSE_END
[gcode_macro PAUSE]
rename_existing: PAUSE_BASE
variable_extrude: 2.0
gcode:
##### read E from pause macro #####
{% set e = printer["gcode_macro PAUSE"].extrude|float %}
##### set park positon for x and y #####
# default is your max posion from your printer.cfg
{% set x_park = printer.toolhead.axis_minimum.x|float + 10 %}
{% set y_park = printer.toolhead.axis_minimum.y|float + 10 %}
{% set travel_speed = printer.toolhead.max_velocity|int %}
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.gcode_move.gcode_position.z|float %}
{% if act_z < (max_z - 2.0) %}
{% set z_safe = act_z + 2.0 %}
{% else %}
{% set z_safe = max_z %}
{% endif %}
##### end of definitions #####
TIMELAPSE_PAUSE
RESPOND PREFIX=tgalarm MSG="Print paused"
PAUSE_BASE
G1 E-{e} F2400
G1 X{x_park} Y{y_park} Z{z_safe} F{travel_speed * 60}
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
##### read E from pause macro #####
{% set e = printer["gcode_macro PAUSE"].extrude|float %}
##### end of definitions #####
{% if velocity in params %}
BASE_RESUME {rawparams}
{% else %}
{% set travel_speed = printer.toolhead.max_velocity|int %}
BASE_RESUME VELOCITY={travel_speed}
{% endif %}
G1 E{e} F2400
TIMELAPSE_RESUME