Disable leveling during G12 (#14385)

This commit is contained in:
Darsey Litzenberger 2019-06-28 17:23:42 -07:00 committed by Scott Lahteine
parent b3f42d2519
commit 946f6bdeaa

View File

@ -30,6 +30,11 @@
#include "../../parser.h"
#include "../../../module/motion.h"
#if HAS_LEVELING
#include "../../../module/planner.h"
#include "../../../feature/bedlevel/bedlevel.h"
#endif
/**
* G12: Clean the nozzle
*/
@ -42,7 +47,17 @@ void GcodeSuite::G12() {
objects = parser.ushortval('T', NOZZLE_CLEAN_TRIANGLES);
const float radius = parser.floatval('R', NOZZLE_CLEAN_CIRCLE_RADIUS);
#if HAS_LEVELING
const bool was_enabled = planner.leveling_active;
set_bed_leveling_enabled(false);
#endif
Nozzle::clean(pattern, strokes, radius, objects);
// Re-enable bed level correction if it had been on
#if HAS_LEVELING
set_bed_leveling_enabled(was_enabled);
#endif
}
#endif // NOZZLE_CLEAN_FEATURE