|
@ -35,36 +35,46 @@ void GcodeSuite::M851() { |
|
|
|
|
|
|
|
|
// Show usage with no parameters
|
|
|
// Show usage with no parameters
|
|
|
if (!parser.seen("XYZ")) { |
|
|
if (!parser.seen("XYZ")) { |
|
|
SERIAL_ECHO_START(); |
|
|
SERIAL_ECHO_MSG(MSG_PROBE_OFFSET " X", probe_offset[X_AXIS], " Y", probe_offset[Y_AXIS], " Z", probe_offset[Z_AXIS]); |
|
|
SERIAL_ECHOLNPAIR(MSG_PROBE_OFFSET " X", probe_offset[X_AXIS], |
|
|
|
|
|
" Y", probe_offset[Y_AXIS], |
|
|
|
|
|
" Z", probe_offset[Z_AXIS]); |
|
|
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Get the modified offsets
|
|
|
float offs[XYZ] = { probe_offset[X_AXIS], probe_offset[Y_AXIS], probe_offset[Z_AXIS] }; |
|
|
const float offs[] = { |
|
|
|
|
|
parser.floatval('X', probe_offset[X_AXIS]), |
|
|
|
|
|
parser.floatval('Y', probe_offset[Y_AXIS]), |
|
|
|
|
|
parser.floatval('Z', probe_offset[Z_AXIS]) |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Error-check
|
|
|
const bool ok = true; |
|
|
if (!WITHIN(offs[X_AXIS], -(X_BED_SIZE), X_BED_SIZE)) { |
|
|
|
|
|
SERIAL_ERROR_MSG("?X out of range (-" STRINGIFY(X_BED_SIZE) " to " STRINGIFY(X_BED_SIZE) ")"); |
|
|
if (parser.seenval('X')) { |
|
|
return; |
|
|
const float x = parser.value_float(); |
|
|
|
|
|
if (WITHIN(x, -(X_BED_SIZE), X_BED_SIZE)) |
|
|
|
|
|
offs[X_AXIS] = x; |
|
|
|
|
|
else { |
|
|
|
|
|
SERIAL_ECHOLNPAIR("?X out of range (-", int(X_BED_SIZE), " to ", int(X_BED_SIZE), ")"); |
|
|
|
|
|
ok = false; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
if (!WITHIN(offs[Y_AXIS], -(Y_BED_SIZE), Y_BED_SIZE)) { |
|
|
|
|
|
SERIAL_ERROR_MSG("?Y out of range (-" STRINGIFY(Y_BED_SIZE) " to " STRINGIFY(Y_BED_SIZE) ")"); |
|
|
if (parser.seenval('Y')) { |
|
|
return; |
|
|
const float y = parser.value_float(); |
|
|
|
|
|
if (WITHIN(y, -(Y_BED_SIZE), Y_BED_SIZE)) |
|
|
|
|
|
offs[Y_AXIS] = y; |
|
|
|
|
|
else { |
|
|
|
|
|
SERIAL_ECHOLNPAIR("?Y out of range (-", int(Y_BED_SIZE), " to ", int(Y_BED_SIZE), ")"); |
|
|
|
|
|
ok = false; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
if (!WITHIN(offs[Z_AXIS], Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { |
|
|
|
|
|
SERIAL_ERROR_MSG("?Z out of range (" STRINGIFY(Z_PROBE_OFFSET_RANGE_MIN) " to " STRINGIFY(Z_PROBE_OFFSET_RANGE_MAX) ")"); |
|
|
if (parser.seenval('Z')) { |
|
|
return; |
|
|
const float z = parser.value_float(); |
|
|
|
|
|
if (WITHIN(z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) |
|
|
|
|
|
offs[Z_AXIS] = z; |
|
|
|
|
|
else { |
|
|
|
|
|
SERIAL_ECHOLNPAIR("?Z out of range (", int(Z_PROBE_OFFSET_RANGE_MIN), " to ", int(Z_PROBE_OFFSET_RANGE_MAX), ")"); |
|
|
|
|
|
ok = false; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Save the new offsets
|
|
|
// Save the new offsets
|
|
|
LOOP_XYZ(a) probe_offset[a] = offs[a]; |
|
|
if (ok) COPY(probe_offset, offs); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // HAS_BED_PROBE
|
|
|
#endif // HAS_BED_PROBE
|
|
|