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 #undef CALIBRATION_MEASURE_AT_TOP_EDGES
#endif #endif
/** /**
* G425 backs away from the calibration object by various distances * G425 backs away from the calibration object by various distances
* depending on the confidence level: * depending on the confidence level:
@ -256,7 +255,7 @@ inline void probe_side(measurements_t &m, const float uncertainty, const side_t
#endif #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 // 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); current_position[axis] = m.obj_center[axis] + (-dir) * (dimensions[axis] / 2 + m.nozzle_outer_dimension[axis] / 2 + uncertainty);
calibration_move(); calibration_move();

View File

@ -46,8 +46,17 @@
void GcodeSuite::M425() { void GcodeSuite::M425() {
bool noArgs = true; 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) { LOOP_XYZ(a) {
if (CAN_CALIBRATE(a) && parser.seen(XYZ_CHAR(a))) { if (AXIS_CAN_CALIBRATE(a) && parser.seen(XYZ_CHAR(a))) {
planner.synchronize(); planner.synchronize();
backlash.distance_mm[a] = parser.has_value() ? parser.value_linear_units() : backlash.get_measurement(AxisEnum(a)); backlash.distance_mm[a] = parser.has_value() ? parser.value_linear_units() : backlash.get_measurement(AxisEnum(a));
noArgs = false; noArgs = false;
@ -74,7 +83,7 @@ void GcodeSuite::M425() {
SERIAL_ECHOLNPGM("active:"); SERIAL_ECHOLNPGM("active:");
SERIAL_ECHOLNPAIR(" Correction Amount/Fade-out: F", backlash.get_correction(), " (F1.0 = full, F0.0 = none)"); SERIAL_ECHOLNPAIR(" Correction Amount/Fade-out: F", backlash.get_correction(), " (F1.0 = full, F0.0 = none)");
SERIAL_ECHOPGM(" Backlash Distance (mm): "); 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_CHAR(' ', XYZ_CHAR(a));
SERIAL_ECHO(backlash.distance_mm[a]); SERIAL_ECHO(backlash.distance_mm[a]);
SERIAL_EOL(); SERIAL_EOL();
@ -87,7 +96,7 @@ void GcodeSuite::M425() {
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING) #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
SERIAL_ECHOPGM(" Average measured backlash (mm):"); SERIAL_ECHOPGM(" Average measured backlash (mm):");
if (backlash.has_any_measurement()) { 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_CHAR(' ', XYZ_CHAR(a));
SERIAL_ECHO(backlash.get_measurement(AxisEnum(a))); SERIAL_ECHO(backlash.get_measurement(AxisEnum(a)));
} }

View File

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