-
Notifications
You must be signed in to change notification settings - Fork 0
/
sensorless.cfg
201 lines (179 loc) · 5.78 KB
/
sensorless.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# Createdate: 2024/01/11
[force_move]
enable_force_move: true
[gcode_macro xyz_ready]
variable_x_ready: 0
variable_y_ready: 0
variable_z_ready: 0
variable_xy_moved: 0
variable_z_moved: 0
variable_safe_z: 3
gcode:
[gcode_macro _IF_HOME_Z]
gcode:
{% if printer['gcode_macro xyz_ready'].z_ready|int == 1 %}
{% if printer.toolhead.position.z|int < 5 %}
{% set z_park = 5.0 - printer.toolhead.position.z|int %}
G91
G1 z{z_park} F600
G90
{% endif %}
{% else %}
{% if printer['gcode_macro xyz_ready'].z_moved|int == 0 %}
{% if printer.print_stats.z_pos|float <= 20.0 or printer.print_stats.power_loss == 1 %}
FORCE_MOVE STEPPER=stepper_z DISTANCE={printer["gcode_macro PRINTER_PARAM"].z_safe_g28} VELOCITY=10
{% else %}
FORCE_MOVE STEPPER=stepper_z DISTANCE=0.1 VELOCITY=10
{% endif %}
SET_GCODE_VARIABLE MACRO=xyz_ready VARIABLE=z_moved VALUE=1
{% endif %}
{% endif %}
[gcode_macro _IF_MOVE_XY]
gcode:
_IF_HOME_Z
{% if printer['gcode_macro xyz_ready'].xy_moved|int == 0 %}
{action_respond_info("move xy\n")}
# FORCE_MOVE STEPPER=stepper_x DISTANCE=14 VELOCITY=50
FORCE_MOVE STEPPER=stepper_y DISTANCE=-14 VELOCITY=50
FORCE_MOVE STEPPER=stepper_y DISTANCE=7 VELOCITY=50
SET_GCODE_VARIABLE MACRO=xyz_ready VARIABLE=xy_moved VALUE=1
G4 P1000
{% endif %}
[gcode_macro _HOME_X]
gcode:
_IF_MOVE_XY
{% if printer['gcode_macro xyz_ready'].x_ready|int == 1 %}
{% if (printer.configfile.settings['stepper_x'].position_max - printer.toolhead.position.x)|round < 10 %}
{% set x_park = (10 - (printer.configfile.settings['stepper_x'].position_max - printer.toolhead.position.x))|round %}
{% if x_park > 0 %}
G91
G1 x-{x_park} F3600
G90
G4 P1000
{% endif %}
{% endif %}
{% endif %}
# SET_TMC_FIELD FIELD=SGTHRS STEPPER=stepper_y VALUE=60
# SET_TMC_FIELD FIELD=SGTHRS STEPPER=stepper_x VALUE=60
# Home
G28 X
SET_GCODE_VARIABLE MACRO=xyz_ready VARIABLE=x_ready VALUE=1
# Move away
G91
G1 x-10 F3600
G90
# Wait just a second (give StallGuard registers time to clear)
G4 P2000
[gcode_macro _HOME_Y]
gcode:
_IF_MOVE_XY
{% if printer['gcode_macro xyz_ready'].y_ready|int == 1 %}
{% if printer.toolhead.position.y|round < 8 %}
{% set y_park = 8 - printer.toolhead.position.y|round %}
{% if y_park > 0 %}
G91
G1 y{y_park} F3600
G90
G4 P1000
{% endif %}
{% endif %}
{% endif %}
# SET_TMC_FIELD FIELD=SGTHRS STEPPER=stepper_y VALUE=60
# SET_TMC_FIELD FIELD=SGTHRS STEPPER=stepper_x VALUE=60
# Home
G28 Y
SET_GCODE_VARIABLE MACRO=xyz_ready VARIABLE=y_ready VALUE=1
# Move away
G91
G1 y10 F3600
G90
# Wait just a second (give StallGuard registers time to clear)
G4 P2000
[gcode_macro _HOME_Z]
gcode:
{% if printer['gcode_macro xyz_ready'].y_ready|int == 1 %}
{% if printer['gcode_macro xyz_ready'].x_ready|int == 1 %}
_IF_HOME_Z
{% endif %}
{% endif %}
{% if printer.print_stats.z_pos|float >= 260.0 %}
FORCE_MOVE STEPPER=stepper_z DISTANCE=-8 VELOCITY=10
{% endif %}
{% set POSITION_X = printer.configfile.settings['stepper_x'].position_max/2 %}
{% set POSITION_Y = printer.configfile.settings['stepper_y'].position_max/2 %}
# BED_MESH_SET_DISABLE
G91
{% set x_park = POSITION_X - printer.toolhead.position.x|int %}
{% set y_park = POSITION_Y - printer.toolhead.position.y|int %}
{action_respond_info("x_park = %s \n" % (x_park))}
{action_respond_info("y_park = %s \n" % (y_park))}
G1 x{x_park} y{y_park} F3600
G90
# G4 P500
G28 Z
SET_GCODE_VARIABLE MACRO=xyz_ready VARIABLE=z_ready VALUE=1
# BED_MESH_SET_ENABLE
[homing_override]
axes: xyz
# set_position_x: 0
# set_position_y: 0
# set_position_z:0
gcode:
M220 S100
# SET_TMC_FIELD STEPPER=stepper_x FIELD=en_spreadcycle VALUE=0
# SET_TMC_FIELD STEPPER=stepper_y FIELD=en_spreadcycle VALUE=0
# BED_MESH_CLEAR
{% set x_axes = printer.toolhead.homed_axes %}
{% if x_axes is defined and x_axes[0] is defined %}
{action_respond_info(
"x_axes: %s \n"
% (x_axes))}
{% else %}
SET_GCODE_VARIABLE MACRO=xyz_ready VARIABLE=x_ready VALUE=0
SET_GCODE_VARIABLE MACRO=xyz_ready VARIABLE=y_ready VALUE=0
SET_GCODE_VARIABLE MACRO=xyz_ready VARIABLE=z_ready VALUE=0
SET_GCODE_VARIABLE MACRO=xyz_ready VARIABLE=xy_moved VALUE=0
SET_GCODE_VARIABLE MACRO=xyz_ready VARIABLE=z_moved VALUE=0
{action_respond_info(
"x_axes is NULL\n")}
{% endif %}
{% if x_axes is not defined or x_axes[2] is not defined %}
BED_MESH_CLEAR
{% endif %}
{% if x_axes is defined and x_axes[0] is defined and x_axes[1] is defined %}
{action_respond_info("x_axes: %s \n"% (x_axes))}
{% set position_y = printer.toolhead.position.y|int %}
{% set max_y_position = printer["gcode_macro PRINTER_PARAM"].max_y_position|int %}
{% if position_y >= max_y_position %}
G91
G0 Y-10 F3600
G90
{% endif %}
{% endif %}
{% set home_all = 'X' not in params and 'Y' not in params %}
{% if 'Z' in params and 'X' not in params and 'Y' not in params %}
{% if x_axes[0] is defined and x_axes[1] is defined %}
{% set home_all = 0 %}
{% endif %}
{% endif %}
{% if home_all or 'X' in params %}
_HOME_X
{% endif %}
{% if home_all or 'Y' in params %}
_HOME_Y
{% endif %}
{% if home_all or 'X' in params %}
_HOME_X
{% endif %}
{% if home_all or 'Y' in params %}
_HOME_Y
{% endif %}
{% if home_all or 'Z' in params %}
_HOME_Z
{% endif %}
BED_MESH_PROFILE LOAD="default"
# SET_TMC_FIELD STEPPER=stepper_x FIELD=en_spreadcycle VALUE=1
# SET_TMC_FIELD STEPPER=stepper_y FIELD=en_spreadcycle VALUE=1
# SET_TMC_FIELD FIELD=SGTHRS STEPPER=stepper_x VALUE=0
# SET_TMC_FIELD FIELD=SGTHRS STEPPER=stepper_y VALUE=0
G4 P500