-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainsail.cfg
117 lines (104 loc) · 4.43 KB
/
mainsail.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
[virtual_sdcard]
path: /home/mks/gcode_files
[pause_resume]
[display_status]
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
TURN_OFF_HEATERS
CANCEL_PRINT_BASE
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
# change this if you need more or less extrusion
variable_extrude: 1.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_maximum.x|float - 5.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - 2.0) %}
{% set z_safe = 2.0 %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
PAUSE_BASE
G91
{% if printer.extruder.can_extrude|lower == 'true' %}
G1 E-{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G1 Z{z_safe} F900
G90
G1 X{x_park} Y{y_park} F6000
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### read E from pause macro #####
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
G91
G1 E{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
######################################
_CLIENT_EXTRUDE
RESUME_BASE VELOCITY={params.VELOCITY|default(sp_move)}
# Usage: SET_PAUSE_NEXT_LAYER [ENABLE=[0|1]] [MACRO=<name>]
#[gcode_macro SET_PAUSE_NEXT_LAYER]
#description: Enable a pause if the next layer is reached
#gcode:
#{% set pause_next_layer = printer['gcode_macro SET_PRINT_STATS_INFO'].pause_next_layer %}
#{% set ENABLE = params.ENABLE | default(1) | int != 0 %}
#{% set MACRO = params.MACRO | default(pause_next_layer.call, True) %}
#SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_next_layer VALUE="{{ 'enable': ENABLE, 'call': MACRO }}"
#Usage: SET_PAUSE_AT_LAYER [ENABLE=[0|1]] [LAYER=<number>] [MACRO=<name>]
#[gcode_macro SET_PAUSE_AT_LAYER]
#description: Enable/disable a pause if a given layer number is reached
#gcode:
#{% set pause_at_layer = printer['gcode_macro SET_PRINT_STATS_INFO'].pause_at_layer %}
#{% set ENABLE = params.ENABLE | int != 0 if params.ENABLE is defined
#else params.LAYER is defined %}
#{% set LAYER = params.LAYER | default(pause_at_layer.layer) | int %}
#{% set MACRO = params.MACRO | default(pause_at_layer.call, True) %}
#SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{{ 'enable': ENABLE, 'layer': LAYER, 'call': MACRO }}"
# Usage: SET_PRINT_STATS_INFO [TOTAL_LAYER=<total_layer_count>] [CURRENT_LAYER= <current_layer>]
#[gcode_macro SET_PRINT_STATS_INFO]
#rename_existing: SET_PRINT_STATS_INFO_BASE
#description: Overwrite, to get pause_next_layer and pause_at_layer feature
#variable_pause_next_layer: { 'enable': False, 'call': "PAUSE" }
#variable_pause_at_layer : { 'enable': False, 'layer': 0, 'call': "PAUSE" }
#gcode:
#{% if pause_next_layer.enable %}
#{action_respond_info("%s, forced by pause_next_layer" % pause_next_layer.call)}
#{pause_next_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE
#SET_PAUSE_NEXT_LAYER ENABLE=0
#{% elif pause_at_layer.enable and params.CURRENT_LAYER is defined and params.CURRENT_LAYER|int == pause_at_layer.layer %}
#{action_respond_info("%s, forced by pause_at_layer [%d]" % (pause_at_layer.call, pause_at_layer.layer))}
#{pause_at_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE
#SET_PAUSE_AT_LAYER ENABLE=0
#{% endif %}
#SET_PRINT_STATS_INFO_BASE {rawparams}
##### internal use #####