G12 E soft endstops parameter (#17788)

This commit is contained in:
Scott Lahteine
2020-04-29 03:25:35 -05:00
committed by GitHub
parent 36adbfa41c
commit 2d758663db
4 changed files with 23 additions and 16 deletions

View File

@ -92,8 +92,6 @@ struct measurements_t {
xy_float_t nozzle_outer_dimension = nod;
};
#define TEMPORARY_SOFT_ENDSTOP_STATE(enable) REMEMBER(tes, soft_endstops_enabled, enable);
#if ENABLED(BACKLASH_GCODE)
#define TEMPORARY_BACKLASH_CORRECTION(value) REMEMBER(tbst, backlash.correction, value)
#else

View File

@ -37,6 +37,11 @@
/**
* G12: Clean the nozzle
*
* E<bool> : 0=Never or 1=Always apply the "software endstop" limits
* P0 S<strokes> : Stroke cleaning with S strokes
* P1 Sn T<objects> : Zigzag cleaning with S repeats and T zigzags
* P2 Sn R<radius> : Circle cleaning with S repeats and R radius
*/
void GcodeSuite::G12() {
// Don't allow nozzle cleaning without homing first
@ -45,14 +50,12 @@ void GcodeSuite::G12() {
const uint8_t pattern = parser.ushortval('P', 0),
strokes = parser.ushortval('S', NOZZLE_CLEAN_STROKES),
objects = parser.ushortval('T', NOZZLE_CLEAN_TRIANGLES);
const float radius = parser.floatval('R', NOZZLE_CLEAN_CIRCLE_RADIUS);
const float radius = parser.linearval('R', NOZZLE_CLEAN_CIRCLE_RADIUS);
const bool seenxyz = parser.seen("XYZ");
const uint8_t cleans = (!seenxyz || parser.boolval('X') ? _BV(X_AXIS) : 0)
| (!seenxyz || parser.boolval('Y') ? _BV(Y_AXIS) : 0)
#if DISABLED(NOZZLE_CLEAN_NO_Z)
| (!seenxyz || parser.boolval('Z') ? _BV(Z_AXIS) : 0)
#endif
| TERN(NOZZLE_CLEAN_NO_Z, 0, (!seenxyz || parser.boolval('Z') ? _BV(Z_AXIS) : 0))
;
#if HAS_LEVELING
@ -60,6 +63,8 @@ void GcodeSuite::G12() {
TEMPORARY_BED_LEVELING_STATE(!TEST(cleans, Z_AXIS) && planner.leveling_active);
#endif
TEMPORARY_SOFT_ENDSTOP_STATE(parser.boolval('E'));
nozzle.clean(pattern, strokes, radius, objects, cleans);
}