-
Notifications
You must be signed in to change notification settings - Fork 0
/
sensorless.cfg
executable file
·201 lines (183 loc) · 5.23 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: 2023/08/08
[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 %}
# BED_MESH_SET_DISABLE
{% if printer.print_stats.power_loss == 1 %}
# SET_KINEMATIC_POSITION
# G91
# G1 z{printer["gcode_macro PRINTER_PARAM"].z_safe_g28} F600
# G90
# G4 P2000
{% else %}
# SET_KINEMATIC_POSITION
# G91
# G1 z2 F600
# G90
# G4 P2000
{% 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 %}
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.toolhead.position.x)|int < 10 %}
G91
G1 x10 F3600
G90
G4 P2000
{% endif %}
{% endif %}
# Home
G28 X
G91
G1 x10 F3600
M400
G90
G4 P500
# SOFTX_G28
SET_GCODE_VARIABLE MACRO=xyz_ready VARIABLE=x_ready VALUE=1
[gcode_macro _HOME_Y]
gcode:
# _IF_MOVE_XY
#{% set HOME_CUR = 0.500 %}
#{% set driver_config = printer.configfile.settings['tmc2209 stepper_y'] %}
#{% set RUN_CUR = driver_config.run_current %}
#SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CUR}
#G4 P2000
{% if printer['gcode_macro xyz_ready'].y_ready|int == 1 %}
{% if (printer.toolhead.position.y)|int < 10 %}
G91
G1 y10 F3600
G90
G4 P2000
{% endif %}
{% endif %}
# Home
#G28 Y
SOFTY_G28
SET_GCODE_VARIABLE MACRO=xyz_ready VARIABLE=y_ready VALUE=1
#SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CUR}
#G4 P1000
[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 %}
{% set POSITION_X = printer.configfile.settings['stepper_x'].position_max/2 %}
{% set POSITION_Y = printer.configfile.settings['stepper_y'].position_max/2 %}
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
M400
G28 Z
SET_GCODE_VARIABLE MACRO=xyz_ready VARIABLE=z_ready VALUE=1
[homing_override]
axes: xyz
gcode:
M220 S100
SET_VELOCITY_LIMIT ACCEL=5000 ACCEL_TO_DECEL=2500
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 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 %}
{% if printer.print_stats.power_loss == 0 %}
SET_KINEMATIC_POSITION
G91
G1 X3 F1200
M400
G90
{% endif %}
STEPPER_Z_SENEORLESS
M400
_HOME_X
{% if printer.print_stats.power_loss == 0 %}
SET_KINEMATIC_POSITION
{% set retract_z = printer.configfile.settings['prtouch_v2'].retract_z_dist %}
{% set retract_speed = printer.configfile.settings['prtouch_v2'].retract_z_speed %}
G91
G1 Z-{retract_z} F{retract_speed}
M400
G90
G4 P500
{% endif %}
{% endif %}
{% if home_all or 'Y' in params %}
{% if printer.print_stats.power_loss == 1 %}
SOFT_CHECK_ERROR FLAG=1
{% endif %}
_HOME_Y
SOFT_CHECK_ERROR FLAG=0
{% 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
BED_MESH_PROFILE LOAD="default"
{% endif %}
G4 P500