|
@@ -142,22 +142,48 @@ Nozzle nozzle;
|
142
|
142
|
void Nozzle::clean(const uint8_t &pattern, const uint8_t &strokes, const float &radius, const uint8_t &objects, const uint8_t cleans) {
|
143
|
143
|
xyz_pos_t start[HOTENDS] = NOZZLE_CLEAN_START_POINT, end[HOTENDS] = NOZZLE_CLEAN_END_POINT, middle[HOTENDS] = NOZZLE_CLEAN_CIRCLE_MIDDLE;
|
144
|
144
|
|
|
145
|
+ const uint8_t arrPos = ANY(SINGLENOZZLE, MIXING_EXTRUDER) ? 0 : active_extruder;
|
|
146
|
+
|
|
147
|
+ #if HAS_SOFTWARE_ENDSTOPS
|
|
148
|
+
|
|
149
|
+ #define LIMIT_AXIS(A) do{ \
|
|
150
|
+ LIMIT( start[arrPos].A, soft_endstop.min.A, soft_endstop.max.A); \
|
|
151
|
+ LIMIT(middle[arrPos].A, soft_endstop.min.A, soft_endstop.max.A); \
|
|
152
|
+ LIMIT( end[arrPos].A, soft_endstop.min.A, soft_endstop.max.A); \
|
|
153
|
+ }while(0)
|
|
154
|
+
|
|
155
|
+ LIMIT_AXIS(x);
|
|
156
|
+ LIMIT_AXIS(y);
|
|
157
|
+ LIMIT_AXIS(z);
|
|
158
|
+
|
|
159
|
+ const bool radiusOutOfRange = (middle[arrPos].x + radius > soft_endstop.max.x)
|
|
160
|
+ || (middle[arrPos].x - radius < soft_endstop.min.x)
|
|
161
|
+ || (middle[arrPos].y + radius > soft_endstop.max.y)
|
|
162
|
+ || (middle[arrPos].y - radius < soft_endstop.min.y);
|
|
163
|
+
|
|
164
|
+ if (radiusOutOfRange && pattern == 2) {
|
|
165
|
+ SERIAL_ECHOLNPGM("Warning: Radius Out of Range");
|
|
166
|
+ return;
|
|
167
|
+ }
|
|
168
|
+
|
|
169
|
+ #endif
|
|
170
|
+
|
145
|
171
|
if (pattern == 2) {
|
146
|
172
|
if (!(cleans & (_BV(X_AXIS) | _BV(Y_AXIS)))) {
|
147
|
|
- SERIAL_ECHOLNPGM("Warning : Clean Circle requires XY");
|
|
173
|
+ SERIAL_ECHOLNPGM("Warning: Clean Circle requires XY");
|
148
|
174
|
return;
|
149
|
175
|
}
|
150
|
176
|
}
|
151
|
177
|
else {
|
152
|
|
- if (!TEST(cleans, X_AXIS)) start[active_extruder].x = end[active_extruder].x = current_position.x;
|
153
|
|
- if (!TEST(cleans, Y_AXIS)) start[active_extruder].y = end[active_extruder].y = current_position.y;
|
|
178
|
+ if (!TEST(cleans, X_AXIS)) start[arrPos].x = end[arrPos].x = current_position.x;
|
|
179
|
+ if (!TEST(cleans, Y_AXIS)) start[arrPos].y = end[arrPos].y = current_position.y;
|
154
|
180
|
}
|
155
|
|
- if (!TEST(cleans, Z_AXIS)) start[active_extruder].z = end[active_extruder].z = current_position.z;
|
|
181
|
+ if (!TEST(cleans, Z_AXIS)) start[arrPos].z = end[arrPos].z = current_position.z;
|
156
|
182
|
|
157
|
183
|
switch (pattern) {
|
158
|
|
- case 1: zigzag(start[active_extruder], end[active_extruder], strokes, objects); break;
|
159
|
|
- case 2: circle(start[active_extruder], middle[active_extruder], strokes, radius); break;
|
160
|
|
- default: stroke(start[active_extruder], end[active_extruder], strokes);
|
|
184
|
+ case 1: zigzag(start[arrPos], end[arrPos], strokes, objects); break;
|
|
185
|
+ case 2: circle(start[arrPos], middle[arrPos], strokes, radius); break;
|
|
186
|
+ default: stroke(start[arrPos], end[arrPos], strokes);
|
161
|
187
|
}
|
162
|
188
|
}
|
163
|
189
|
|