-
Notifications
You must be signed in to change notification settings - Fork 0
/
macro.cfg
175 lines (144 loc) · 5.8 KB
/
macro.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
163
164
165
166
167
168
169
170
171
172
173
174
175
#####################################################################
# Macros
#####################################################################
[gcode_macro PRINT_START]
# Use PRINT_START for the slicer starting script - please customize for your slicer of choice
gcode:
#### set defaults ####
Nozzle_LED_10
{% set extruder = params.EXTRUDER|default(0) %}
{% set bed = params.BED|default(0) %}
# Wait for bed to reach temperature
M190 S{bed}
M109 S{extruder}
G28 ; home all axes
G90 ; absolute positioning
G1 Z20 F3000 ; move nozzle away from bed
[gcode_macro PRINT_END]
# Use PRINT_END for the slicer ending script - please customize for your slicer of choice
gcode:
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-4.0 F3600 ; retract filament
G91 ; relative positioning
# Get Boundaries
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
{% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %}
# Check end position to determine safe direction to move
{% if printer.toolhead.position.x < (max_x - 20) %}
{% set x_safe = 20.0 %}
{% else %}
{% set x_safe = -20.0 %}
{% endif %}
{% if printer.toolhead.position.y < (max_y - 20) %}
{% set y_safe = 20.0 %}
{% else %}
{% set y_safe = -20.0 %}
{% endif %}
{% if printer.toolhead.position.z < (max_z - 2) %}
{% set z_safe = 2.0 %}
{% else %}
{% set z_safe = max_z - printer.toolhead.position.z %}
{% endif %}
G0 Z{z_safe} F3600 ; move nozzle up
G0 X{x_safe} Y{y_safe} F20000 ; move nozzle to remove stringing
TURN_OFF_HEATERS
M107 ; turn off fan
G90 ; absolute positioning
G0 X60 Y{max_y-10} F3600 ; park nozzle at rear
ALL_LED_OFF
M18
[gcode_macro LOAD_FILAMENT]
description: CYD_SCREEN_MACRO
gcode:
M83 ; set extruder to relative
G1 E30 F300 ; load
G1 E15 F150 ; prime nozzle with filament
M82 ; set extruder to absolute
[gcode_macro UNLOAD_FILAMENT]
description: CYD_SCREEN_MACRO
gcode:
M83 ; set extruder to relative
G1 E10 F300 ; extrude a little to soften tip
G1 E-80 F1800 ; retract some, but not too much or it will jam
M82 ; set extruder to absolute
[gcode_macro _HOME_X]
gcode:
# Always use consistent run_current on A/B steppers during sensorless homing
{% set RUN_CURRENT_X = printer.configfile.settings['tmc2209 stepper_x'].run_current|float %}
{% set RUN_CURRENT_Y = printer.configfile.settings['tmc2209 stepper_y'].run_current|float %}
{% set HOME_CURRENT_RATIO = 0.7 %} # by default we are dropping the motor current during homing. you can adjust this value if you are having trouble with skipping while homing
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CURRENT_RATIO * RUN_CURRENT_X}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CURRENT_RATIO * RUN_CURRENT_Y}
# Home
G28 X
# Move away
G91
G1 X-20 F1200
# Wait just a second… (give StallGuard registers time to clear)
G4 P1000
G90
# Set current during print
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT_X}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT_Y}
[gcode_macro _HOME_Y]
gcode:
# Set current for sensorless homing
{% set RUN_CURRENT_X = printer.configfile.settings['tmc2209 stepper_x'].run_current|float %}
{% set RUN_CURRENT_Y = printer.configfile.settings['tmc2209 stepper_y'].run_current|float %}
{% set HOME_CURRENT_RATIO = 0.7 %} # by default we are dropping the motor current during homing. you can adjust this value if you are having trouble with skipping while homing
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CURRENT_RATIO * RUN_CURRENT_X}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CURRENT_RATIO * RUN_CURRENT_Y}
# Home
G28 Y
# Move away
G91
G1 Y-20 F1200
# Wait just a second… (give StallGuard registers time to clear)
G4 P1000
G90
# Set current during print
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT_X}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT_Y}
[gcode_macro _HOME_Z]
gcode:
G90
G28 Z
G1 Z30
[gcode_macro CENTER]
gcode:
G90
G0 X60 Y60 Z30 F1200
[gcode_shell_command backup_cfg]
command: sh /home/biqu/printer_data/config/autocommit.sh
timeout: 30.
verbose: True
[gcode_macro BACKUP_CFG]
gcode: RUN_SHELL_COMMAND CMD=backup_cfg
#####################################################################
# Light
#####################################################################
[gcode_macro Caselight_OFF]
description: CYD_SCREEN_MACRO
gcode: SET_PIN PIN=Caselight VALUE=0
[gcode_macro Caselight_5]
description: CYD_SCREEN_MACRO
gcode: SET_PIN PIN=Caselight VALUE=0.05
[gcode_macro Caselight_10]
gcode: SET_PIN PIN=Caselight VALUE=0.1
[gcode_macro Caselight_50]
gcode: SET_PIN PIN=Caselight VALUE=0.5
[gcode_macro Nozzle_LED_OFF]
description: CYD_SCREEN_MACRO
gcode: SET_PIN PIN=Hotend-LED value=0
[gcode_macro Nozzle_LED_5]
gcode: SET_PIN PIN=Hotend-LED value=0.05
[gcode_macro Nozzle_LED_10]
description: CYD_SCREEN_MACRO
gcode: SET_PIN PIN=Hotend-LED value=0.1
[gcode_macro Nozzle_LED_50]
gcode: SET_PIN PIN=Hotend-LED value=0.5
[gcode_macro ALL_LED_OFF]
gcode: SET_PIN PIN=Caselight VALUE=0
SET_PIN PIN=Hotend-LED value=0