Allow nozzle clean with limited Axis (#14619)

This commit is contained in:
InsanityAutomation
2019-07-14 07:58:53 -04:00
committed by Scott Lahteine
parent 6dcb85927a
commit d2f20803ba
114 changed files with 483 additions and 122 deletions

View File

@ -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
}