-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacros.cfg
162 lines (141 loc) · 6.85 KB
/
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
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
155
156
157
158
159
160
161
162
# STATUS_READY
# STATUS_OFF
# STATUS_BUSY
# STATUS_HEATING
# STATUS_LEVELING
# STATUS_HOMING
# STATUS_CLEANING
# STATUS_MESHING
# STATUS_CALIBRATING_Z
[gcode_macro PRINT_START]
variable_bedtemp: 0
gcode:
# Parameters
{% set bed = params.BED|int %}
{% set hotend = params.HOTEND|int %}
# Set the parameters as persistent variables so they can be referenced in PRINT_END and elsewhere
SET_GCODE_VARIABLE MACRO=PRINT_START VARIABLE=bedtemp VALUE={bed}
M117 Starting Print
RESETSPEEDS # reset speeds and accels to config values
CG28 # home
G90 # absolute positioning
G0 X117.5 Y117.5 Z10 F10800 # move toolhead for preheat
STATUS_HEATING
M117 Start - Heating Bed
M140 S{bed} # set bed final temp
M104 S140 # set hotend to PLA no-ooze temp
M190 S{bed} # wait for bed final temp
STATUS_HOMING
ZCG28 # home z
M117 Start - Meshing Bed
STATUS_MESHING
BED_MESH_CALIBRATE # generate bed mesh
M104 S{hotend} # set extruder final temp
M117 Start - Heating Hotend
STATUS_HEATING
G1 X0.1 Y20 Z5 F5000.0 # move above start position
M109 S{hotend} # wait for extruder final temp
G92 E0 # Reset Extruder
G1 Z2.0 F600 # Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.1 Y20 Z0.3 F5000.0 # Move to start position
M117 Start - Priming
STATUS_CLEANING
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 # Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 # Move to side a little
G1 X0.4 Y30 Z0.3 F1500.0 E28.33 # Draw the second line (minus 1CM)
G92 E0 # Reset Extruder
G1 Z0.3 F600 # Move Z Axis up little to prevent scratching of Heat Bed
M117 Printing
STATUS_PRINTING
# SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=1 # enable filament sensor
[gcode_macro PRINT_END]
# Use PRINT_END for the slicer ending script - please customize for your slicer of choice
gcode:
# SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0 # disable filament sensor
M400 # wait for buffer to clear
G92 E0 # zero the extruder
G10 # retract filament
G91 # relative positioning
M107 # turn off fan
G1 Z5 F3000 # move nozzle up 5mm
G90 # absolute positioning
G0 X{printer.toolhead.axis_maximum.x-30} Y{printer.toolhead.axis_maximum.y-30} F1800 # park nozzle at rear
#M18 # turn off steppers
BED_MESH_CLEAR # clear mesh
M104 S0 # turn off hotend
#M140 S{printer["gcode_macro PRINT_START"].bedtemp|int} # return the bed to temp, some slicers like to turn it off
#UPDATE_DELAYED_GCODE ID=DELAYED_OFF DURATION=600 # turn everything off in 10 min
OFF # turn everything off
BEEP I=3 # beep 3 times
STATUS_READY
############################# MISC ##################################
# Conditional G28 (home if not already homed)
[gcode_macro CG28]
gcode:
{% if "x" not in printer.toolhead.homed_axes or "y" not in printer.toolhead.homed_axes or "z" not in printer.toolhead.homed_axes %}
G28
{% endif %}
[gcode_macro ZCG28]
gcode:
{% if "z" not in printer.toolhead.homed_axes %}
G28 Z
G28 Z
{% endif %}
[gcode_macro ZDOWN]
gcode:
SET_GCODE_OFFSET Z_ADJUST=-0.025 MOVE=1
[gcode_macro ZUP]
gcode:
SET_GCODE_OFFSET Z_ADJUST=0.025 MOVE=1
[gcode_macro BMC]
gcode:
BED_MESH_CALIBRATE
[gcode_macro BEEP]
gcode:
# Parameters
{% set i = params.I|default(1)|int %} ; Iterations (number of times to beep).
{% set dur = params.DUR|default(100)|int %} ; Duration/wait of each beep in ms. Default 100ms.
{% for iteration in range(i|int) %}
SET_PIN PIN=beeper VALUE=1
G4 P{dur}
SET_PIN PIN=beeper VALUE=0
G4 P{dur}
{% endfor %}
[gcode_macro OFF]
gcode:
M84 ; turn steppers off
TURN_OFF_HEATERS ; turn bed / hotend off
M107 ; turn print cooling fan off
[delayed_gcode DELAYED_OFF]
gcode:
OFF ; call "OFF" macro, to turn off everything (heaters, motors, fans)
[gcode_macro RESETSPEEDS]
gcode:
SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel} SQUARE_CORNER_VELOCITY={printer.configfile.settings.printer.square_corner_velocity}
# Replace M109 (Wait for Hotend Temperature) with TEMPERATURE_WAIT so we don't have to wait for PID to level off.
[gcode_macro M109]
rename_existing: M99109
gcode:
#Parameters
{% set s = params.S|float %}
{% if s != 0 %}
M104 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={s} MAXIMUM={s+1}
{% endif %}
# Override M190 (Wait for Bed Temperature) with TEMPERATURE_WAIT so we don't have to wait for PID to level off.
[gcode_macro M190]
rename_existing: M99190
gcode:
#Parameters
{% set s = params.S|float %}
{% if s != 0 %}
M140 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %} ; Set bed temp
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={s} MAXIMUM={s+4} ; Wait for bed temp
{% endif %}
[gcode_shell_command backup_to_github]
command: sh /home/pi/gitbackup.sh
timeout: 30.
verbose: True
[gcode_macro GITHUB_BACKUP]
gcode:
RUN_SHELL_COMMAND CMD=backup_to_github