Patch M425 for CAN_CALIBRATE

Fixes #17430
This commit is contained in:
Scott Lahteine 2020-04-17 10:24:20 -05:00
parent f94ab84dac
commit 3a42b6c5c6
3 changed files with 14 additions and 6 deletions

View File

@ -51,7 +51,6 @@
#undef CALIBRATION_MEASURE_AT_TOP_EDGES
#endif
/**
* G425 backs away from the calibration object by various distances
* depending on the confidence level:
@ -256,7 +255,7 @@ inline void probe_side(measurements_t &m, const float uncertainty, const side_t
#endif
}
if (AXIS_CAN_CALIBRATE(X) && axis == X_AXIS || AXIS_CAN_CALIBRATE(Y) && axis == Y_AXIS) {
if ((AXIS_CAN_CALIBRATE(X) && axis == X_AXIS) || (AXIS_CAN_CALIBRATE(Y) && axis == Y_AXIS)) {
// Move to safe distance to the side of the calibration object
current_position[axis] = m.obj_center[axis] + (-dir) * (dimensions[axis] / 2 + m.nozzle_outer_dimension[axis] / 2 + uncertainty);
calibration_move();

View File

@ -46,8 +46,17 @@
void GcodeSuite::M425() {
bool noArgs = true;
auto axis_can_calibrate = [](const uint8_t a) {
switch (a) {
default:
case X_AXIS: return AXIS_CAN_CALIBRATE(X);
case Y_AXIS: return AXIS_CAN_CALIBRATE(Y);
case Z_AXIS: return AXIS_CAN_CALIBRATE(Z);
}
};
LOOP_XYZ(a) {
if (CAN_CALIBRATE(a) && parser.seen(XYZ_CHAR(a))) {
if (AXIS_CAN_CALIBRATE(a) && parser.seen(XYZ_CHAR(a))) {
planner.synchronize();
backlash.distance_mm[a] = parser.has_value() ? parser.value_linear_units() : backlash.get_measurement(AxisEnum(a));
noArgs = false;
@ -74,7 +83,7 @@ void GcodeSuite::M425() {
SERIAL_ECHOLNPGM("active:");
SERIAL_ECHOLNPAIR(" Correction Amount/Fade-out: F", backlash.get_correction(), " (F1.0 = full, F0.0 = none)");
SERIAL_ECHOPGM(" Backlash Distance (mm): ");
LOOP_XYZ(a) if (CAN_CALIBRATE(a)) {
LOOP_XYZ(a) if (axis_can_calibrate(a)) {
SERIAL_CHAR(' ', XYZ_CHAR(a));
SERIAL_ECHO(backlash.distance_mm[a]);
SERIAL_EOL();
@ -87,7 +96,7 @@ void GcodeSuite::M425() {
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
SERIAL_ECHOPGM(" Average measured backlash (mm):");
if (backlash.has_any_measurement()) {
LOOP_XYZ(a) if (CAN_CALIBRATE(a) && backlash.has_measurement(AxisEnum(a))) {
LOOP_XYZ(a) if (axis_can_calibrate(a) && backlash.has_measurement(AxisEnum(a))) {
SERIAL_CHAR(' ', XYZ_CHAR(a));
SERIAL_ECHO(backlash.get_measurement(AxisEnum(a)));
}

View File

@ -147,7 +147,7 @@
#define Z_AXIS_INDEX 2
#define CAN_CALIBRATE(A,B) (A##_AXIS_INDEX == B##_INDEX)
#else
#define CAN_CALIBRATE(...) 1
#define CAN_CALIBRATE(A,B) 1
#endif
#endif
#define AXIS_CAN_CALIBRATE(A) CAN_CALIBRATE(A,NORMAL_AXIS)