Fix G12 for SINGLENOZZLE (#17540)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
c7f9eb7b21
commit
65daf3ba40
1 changed files with 33 additions and 7 deletions
|
@ -142,22 +142,48 @@ Nozzle nozzle;
|
||||||
void Nozzle::clean(const uint8_t &pattern, const uint8_t &strokes, const float &radius, const uint8_t &objects, const uint8_t cleans) {
|
void Nozzle::clean(const uint8_t &pattern, const uint8_t &strokes, const float &radius, const uint8_t &objects, const uint8_t cleans) {
|
||||||
xyz_pos_t start[HOTENDS] = NOZZLE_CLEAN_START_POINT, end[HOTENDS] = NOZZLE_CLEAN_END_POINT, middle[HOTENDS] = NOZZLE_CLEAN_CIRCLE_MIDDLE;
|
xyz_pos_t start[HOTENDS] = NOZZLE_CLEAN_START_POINT, end[HOTENDS] = NOZZLE_CLEAN_END_POINT, middle[HOTENDS] = NOZZLE_CLEAN_CIRCLE_MIDDLE;
|
||||||
|
|
||||||
|
const uint8_t arrPos = ANY(SINGLENOZZLE, MIXING_EXTRUDER) ? 0 : active_extruder;
|
||||||
|
|
||||||
|
#if HAS_SOFTWARE_ENDSTOPS
|
||||||
|
|
||||||
|
#define LIMIT_AXIS(A) do{ \
|
||||||
|
LIMIT( start[arrPos].A, soft_endstop.min.A, soft_endstop.max.A); \
|
||||||
|
LIMIT(middle[arrPos].A, soft_endstop.min.A, soft_endstop.max.A); \
|
||||||
|
LIMIT( end[arrPos].A, soft_endstop.min.A, soft_endstop.max.A); \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
LIMIT_AXIS(x);
|
||||||
|
LIMIT_AXIS(y);
|
||||||
|
LIMIT_AXIS(z);
|
||||||
|
|
||||||
|
const bool radiusOutOfRange = (middle[arrPos].x + radius > soft_endstop.max.x)
|
||||||
|
|| (middle[arrPos].x - radius < soft_endstop.min.x)
|
||||||
|
|| (middle[arrPos].y + radius > soft_endstop.max.y)
|
||||||
|
|| (middle[arrPos].y - radius < soft_endstop.min.y);
|
||||||
|
|
||||||
|
if (radiusOutOfRange && pattern == 2) {
|
||||||
|
SERIAL_ECHOLNPGM("Warning: Radius Out of Range");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pattern == 2) {
|
if (pattern == 2) {
|
||||||
if (!(cleans & (_BV(X_AXIS) | _BV(Y_AXIS)))) {
|
if (!(cleans & (_BV(X_AXIS) | _BV(Y_AXIS)))) {
|
||||||
SERIAL_ECHOLNPGM("Warning : Clean Circle requires XY");
|
SERIAL_ECHOLNPGM("Warning: Clean Circle requires XY");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!TEST(cleans, X_AXIS)) start[active_extruder].x = end[active_extruder].x = current_position.x;
|
if (!TEST(cleans, X_AXIS)) start[arrPos].x = end[arrPos].x = current_position.x;
|
||||||
if (!TEST(cleans, Y_AXIS)) start[active_extruder].y = end[active_extruder].y = current_position.y;
|
if (!TEST(cleans, Y_AXIS)) start[arrPos].y = end[arrPos].y = current_position.y;
|
||||||
}
|
}
|
||||||
if (!TEST(cleans, Z_AXIS)) start[active_extruder].z = end[active_extruder].z = current_position.z;
|
if (!TEST(cleans, Z_AXIS)) start[arrPos].z = end[arrPos].z = current_position.z;
|
||||||
|
|
||||||
switch (pattern) {
|
switch (pattern) {
|
||||||
case 1: zigzag(start[active_extruder], end[active_extruder], strokes, objects); break;
|
case 1: zigzag(start[arrPos], end[arrPos], strokes, objects); break;
|
||||||
case 2: circle(start[active_extruder], middle[active_extruder], strokes, radius); break;
|
case 2: circle(start[arrPos], middle[arrPos], strokes, radius); break;
|
||||||
default: stroke(start[active_extruder], end[active_extruder], strokes);
|
default: stroke(start[arrPos], end[arrPos], strokes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue