Skip to content

Commit

Permalink
ideal M666, if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jun 23, 2021
1 parent ec1cb6e commit bc43b78
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions Marlin/src/gcode/calibrate/M666.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,36 +71,28 @@
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
if (parser.seenval('Z')) {
#if NUM_Z_STEPPER_DRIVERS >= 3
const float z_adj = parser.value_linear_units();
const int ind = parser.intval('S');
if (!ind || ind == 2) endstops.z2_endstop_adj = z_adj;
if (!ind || ind == 3) endstops.z3_endstop_adj = z_adj;
#if NUM_Z_STEPPER_DRIVERS >= 4
if (!ind || ind == 4) endstops.z4_endstop_adj = z_adj;
#endif
const float z_adj = parser.value_linear_units();
#if NUM_Z_STEPPER_DRIVERS == 2
endstops.z2_endstop_adj = z_adj;
#else
endstops.z2_endstop_adj = parser.value_linear_units();
const int ind = parser.intval('S');
#define _SET_ZADJ(N) if (!ind || ind == N) endstops.z##N##_endstop_adj = z_adj;
REPEAT_S(2, INCREMENT(NUM_Z_STEPPER_DRIVERS), _SET_ZADJ)
#endif
}
#endif
if (!parser.seen("XYZ")) {
auto echo_adj = [](PGM_P const label, const_float_t value) { SERIAL_ECHOPAIR_P(label, value); };
SERIAL_ECHOPGM("Dual Endstop Adjustment (mm): ");
#if ENABLED(X_DUAL_ENDSTOPS)
SERIAL_ECHOPAIR(" X2:", endstops.x2_endstop_adj);
echo_adj(PSTR(" X2:"), endstops.x2_endstop_adj);
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
SERIAL_ECHOPAIR(" Y2:", endstops.y2_endstop_adj);
echo_adj(PSTR(" Y2:"), endstops.y2_endstop_adj);
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
#define _ECHO_ZADJ(N) SERIAL_ECHOPAIR(" Z" STRINGIFY(N) ":", endstops.z##N##_endstop_adj);
_ECHO_ZADJ(2)
#if NUM_Z_STEPPER_DRIVERS >= 3
_ECHO_ZADJ(3)
#if NUM_Z_STEPPER_DRIVERS >= 4
_ECHO_ZADJ(4)
#endif
#endif
#define _ECHO_ZADJ(N) echo_adj(PSTR(" Z" STRINGIFY(N) ":"), endstops.z##N##_endstop_adj);
REPEAT_S(2, INCREMENT(NUM_Z_STEPPER_DRIVERS), _ECHO_ZADJ)
#endif
SERIAL_EOL();
}
Expand Down

0 comments on commit bc43b78

Please sign in to comment.