Browse Source

🚸 Strict index 2 for M913 / M914 XY (#24680)

FB4S_WIFI^2^2
Giuliano Zaro 2 years ago
committed by Scott Lahteine
parent
commit
5fe1f66478
  1. 9
      Marlin/src/gcode/feature/trinamic/M911-M914.cpp
  2. 6
      Marlin/src/inc/SanityCheck.h

9
Marlin/src/gcode/feature/trinamic/M911-M914.cpp

@ -294,14 +294,14 @@
#if X_HAS_STEALTHCHOP || X2_HAS_STEALTHCHOP #if X_HAS_STEALTHCHOP || X2_HAS_STEALTHCHOP
case X_AXIS: case X_AXIS:
TERN_(X_HAS_STEALTHCHOP, if (index < 2) TMC_SET_PWMTHRS(X,X)); TERN_(X_HAS_STEALTHCHOP, if (index < 2) TMC_SET_PWMTHRS(X,X));
TERN_(X2_HAS_STEALTHCHOP, if (!(index & 1)) TMC_SET_PWMTHRS(X,X2)); TERN_(X2_HAS_STEALTHCHOP, if (!index || index == 2) TMC_SET_PWMTHRS(X,X2));
break; break;
#endif #endif
#if Y_HAS_STEALTHCHOP || Y2_HAS_STEALTHCHOP #if Y_HAS_STEALTHCHOP || Y2_HAS_STEALTHCHOP
case Y_AXIS: case Y_AXIS:
TERN_(Y_HAS_STEALTHCHOP, if (index < 2) TMC_SET_PWMTHRS(Y,Y)); TERN_(Y_HAS_STEALTHCHOP, if (index < 2) TMC_SET_PWMTHRS(Y,Y));
TERN_(Y2_HAS_STEALTHCHOP, if (!(index & 1)) TMC_SET_PWMTHRS(Y,Y2)); TERN_(Y2_HAS_STEALTHCHOP, if (!index || index == 2) TMC_SET_PWMTHRS(Y,Y2));
break; break;
#endif #endif
@ -499,7 +499,6 @@
* M914: Set StallGuard sensitivity. * M914: Set StallGuard sensitivity.
*/ */
void GcodeSuite::M914() { void GcodeSuite::M914() {
bool report = true; bool report = true;
const uint8_t index = parser.byteval('I'); const uint8_t index = parser.byteval('I');
LOOP_NUM_AXES(i) if (parser.seen(AXIS_CHAR(i))) { LOOP_NUM_AXES(i) if (parser.seen(AXIS_CHAR(i))) {
@ -509,13 +508,13 @@
#if X_SENSORLESS #if X_SENSORLESS
case X_AXIS: case X_AXIS:
if (index < 2) stepperX.homing_threshold(value); if (index < 2) stepperX.homing_threshold(value);
TERN_(X2_SENSORLESS, if (!(index & 1)) stepperX2.homing_threshold(value)); TERN_(X2_SENSORLESS, if (!index || index == 2) stepperX2.homing_threshold(value));
break; break;
#endif #endif
#if Y_SENSORLESS #if Y_SENSORLESS
case Y_AXIS: case Y_AXIS:
if (index < 2) stepperY.homing_threshold(value); if (index < 2) stepperY.homing_threshold(value);
TERN_(Y2_SENSORLESS, if (!(index & 1)) stepperY2.homing_threshold(value)); TERN_(Y2_SENSORLESS, if (!index || index == 2) stepperY2.homing_threshold(value));
break; break;
#endif #endif
#if Z_SENSORLESS #if Z_SENSORLESS

6
Marlin/src/inc/SanityCheck.h

@ -2044,6 +2044,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
); );
#endif #endif
#define COUNT_SENSORLESS COUNT_ENABLED(Z_SENSORLESS, Z2_SENSORLESS, Z3_SENSORLESS, Z4_SENSORLESS)
#if COUNT_SENSORLESS && COUNT_SENSORLESS != NUM_Z_STEPPERS
#error "All Z steppers must have *_STALL_SENSITIVITY defined to use Z sensorless homing."
#endif
#undef COUNT_SENSORLESS
#ifdef SENSORLESS_BACKOFF_MM #ifdef SENSORLESS_BACKOFF_MM
constexpr float sbm[] = SENSORLESS_BACKOFF_MM; constexpr float sbm[] = SENSORLESS_BACKOFF_MM;
static_assert(COUNT(sbm) == NUM_AXES, "SENSORLESS_BACKOFF_MM must have " _NUM_AXES_STR "elements (and no others)."); static_assert(COUNT(sbm) == NUM_AXES, "SENSORLESS_BACKOFF_MM must have " _NUM_AXES_STR "elements (and no others).");

Loading…
Cancel
Save