-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartendcancelpause.cfg
154 lines (128 loc) · 6.61 KB
/
startendcancelpause.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
[delayed_gcode DISABLEFILAMENTSENSOR]
initial_duration: 1
gcode:
SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0
[gcode_macro M600]
gcode:
{% set X = 50 %}
{% set Y = 0 %}
{% set Z = 10 %}
SAVE_GCODE_STATE NAME=M600_state
PAUSE
G91
G1 E-.8 F2700
G1 Z{Z}
G90
G1 X{X} Y{Y} F3000
G91
G1 E-50 F1000
RESTORE_GCODE_STATE NAME=M600_state
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value
CLEAR_PAUSE
SDCARD_RESET_FILE
PRINT_END
BASE_CANCEL_PRINT
#SAVE_VARIABLE VARIABLE=last_file VALUE="{printer.virtual_sdcard.file_path}"
#SAVE_VARIABLE VARIABLE=last_file VALUE={ filename[-1] }
[gcode_macro PRINT_START]
description: Call from slicer
gcode:
{% set svv = printer.save_variables.variables %}
{% set preprint_bedlevel=svv.preprint_bedlevel %}
{% set filepath=printer.virtual_sdcard.file_path %}
{% set filename=filepath.split('/')%}
SAVE_VARIABLE VARIABLE=last_file VALUE='"{ filename[-1] }"'
SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=1
EXCLUDE_OBJECT_DEFINE
G90 ; use absolute coordinates
M83 ; extruder relative mode
M140 S60 ; set bed temp
M104 S150 ; set temporary nozzle temp to prevent oozing during homing and auto bed leveling
M190 S60 ; set bed temp and wait before homing
G28 ; home all axis
{% if preprint_bedlevel %}
BED_MESH_CALIBRATE
{% endif %}
G1 Z20 F240
G1 X2 Y60 F3000
M109 S200 ; wait for nozzle temp to stabilize
#################################################################################
#Change babysteps here
#SET_GCODE_OFFSET Z=-0.070
#################################################################################
G1 Z0.28 F240
G92 E0
G1 Y140 E10 F1500 ; prime the nozzle
G1 X2.3 F5000
G92 E0
G1 Y60 E10 F1200 ; prime the nozzle
G92 E0
[gcode_macro PRINT_END]
description: Call from slicer
gcode:
{% set svv = printer.save_variables.variables %}
{% set postprint_cooldown=svv.postprint_cooldown %}
SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0
PRESENT
{% if postprint_cooldown %}
M140 S0 ; turn off heatbed
M104 S0 ; turn off temperature
M107 ; turn off fan
{% endif %}
M84 X Y E ; disable motors
UPDATE_DELAYED_GCODE ID=POWER_OFF_PRINTER_CHECK DURATION=30
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
# Parameters
{% set z = params.Z|default(100)|int %} ; z hop amount
{% if printer['pause_resume'].is_paused|int == 0 %}
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE={z} ; set z hop variable for reference in resume macro
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=etemp VALUE={printer['extruder'].target} ; set hotend temp variable for reference in resume macro
SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0 ; disable filament sensor
SAVE_GCODE_STATE NAME=PAUSE ; save current print position for resume
BASE_PAUSE ; pause print
{% if (printer.gcode_move.position.z + z) < printer.toolhead.axis_maximum.z %} ; check that zhop doesn't exceed z max
G91 ; relative positioning
G1 Z{z} F900 ; raise Z up by z hop amount
{% else %}
{ action_respond_info("Pause zhop exceeds maximum Z height.") } ; if z max is exceeded, show message and set zhop value for resume to 0
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE=0
{% endif %}
G90 ; absolute positioning
G1 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} F6000 ; park toolhead at front center
SAVE_GCODE_STATE NAME=PAUSEPARK ; save parked position in case toolhead is moved during the pause (otherwise the return zhop can error)
M104 S0 ; turn off hotend
SET_IDLE_TIMEOUT TIMEOUT=43200 ; set timeout to 12 hours
{% endif %}
[gcode_macro RESUME]
rename_existing: BASE_RESUME
variable_zhop: 0
variable_etemp: 0
gcode:
# Parameters
{% set e = params.E|default(2.5)|int %} ; hotend prime amount (in mm)
{% if printer['pause_resume'].is_paused|int == 1 %}
SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=1 ; enable filament sensor
#RESETRGB ; reset LCD color
SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value
{% if etemp > 0 %}
M109 S{etemp|int} ; wait for hotend to heat back up
{% endif %}
RESTORE_GCODE_STATE NAME=PAUSEPARK MOVE=1 MOVE_SPEED=100 ; go back to parked position in case toolhead was moved during pause (otherwise the return zhop can error)
G91 ; relative positioning
M83 ; relative extruder positioning
{% if printer[printer.toolhead.extruder].temperature >= printer.configfile.settings.extruder.min_extrude_temp %}
G1 Z{zhop * -1} E{e} F900 ; prime nozzle by E, lower Z back down
{% else %}
G1 Z{zhop * -1} F900 ; lower Z back down without priming (just in case we are testing the macro with cold hotend)
{% endif %}
RESTORE_GCODE_STATE NAME=PAUSE MOVE=1 MOVE_SPEED=60 ; restore position
BASE_RESUME ; resume print
{% endif %}