Allow nozzle clean with limited Axis (#14619)
This commit is contained in:
committed by
Scott Lahteine
parent
6dcb85927a
commit
d2f20803ba
@ -42,6 +42,16 @@ void GcodeSuite::G12() {
|
||||
// Don't allow nozzle cleaning without homing first
|
||||
if (axis_unhomed_error()) return;
|
||||
|
||||
const bool seenxyz = parser.seen("XYZ"),
|
||||
clean_x = !seenxyz || parser.boolval('X'),
|
||||
clean_y = !seenxyz || parser.boolval('Y');
|
||||
|
||||
#if ENABLED(NOZZLE_CLEAN_NO_Z)
|
||||
static constexpr bool clean_z = false;
|
||||
#else
|
||||
const bool clean_z = !seenxyz || parser.boolval('Z');
|
||||
#endif
|
||||
|
||||
const uint8_t pattern = parser.ushortval('P', 0),
|
||||
strokes = parser.ushortval('S', NOZZLE_CLEAN_STROKES),
|
||||
objects = parser.ushortval('T', NOZZLE_CLEAN_TRIANGLES);
|
||||
@ -49,14 +59,14 @@ void GcodeSuite::G12() {
|
||||
|
||||
#if HAS_LEVELING
|
||||
const bool was_enabled = planner.leveling_active;
|
||||
set_bed_leveling_enabled(false);
|
||||
if (clean_z) set_bed_leveling_enabled(false);
|
||||
#endif
|
||||
|
||||
Nozzle::clean(pattern, strokes, radius, objects);
|
||||
Nozzle::clean(pattern, strokes, radius, objects, clean_x, clean_y, clean_z);
|
||||
|
||||
// Re-enable bed level correction if it had been on
|
||||
#if HAS_LEVELING
|
||||
set_bed_leveling_enabled(was_enabled);
|
||||
if (clean_z) set_bed_leveling_enabled(was_enabled);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user