Browse Source

[2.0.x] Add missing axes to M911, M912 (#10668)

pull/1/head
Giuliano 7 years ago
committed by Scott Lahteine
parent
commit
44f3a6dc3b
  1. 81
      Marlin/src/gcode/feature/trinamic/M911-M915.cpp

81
Marlin/src/gcode/feature/trinamic/M911-M915.cpp

@ -32,46 +32,95 @@
/**
* M911: Report TMC stepper driver overtemperature pre-warn flag
* The flag is held by the library and persist until manually cleared by M912
* This flag is held by the library, persisting until cleared by M912
*/
void GcodeSuite::M911() {
#if ENABLED(X_IS_TMC2130) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX)) || ENABLED(IS_TRAMS)
tmc_report_otpw(stepperX, TMC_X);
#endif
#if ENABLED(X2_IS_TMC2130) || (ENABLED(X2_IS_TMC2208) && PIN_EXISTS(X2_SERIAL_RX))
tmc_report_otpw(stepperX2, TMC_X2);
#endif
#if ENABLED(Y_IS_TMC2130) || (ENABLED(Y_IS_TMC2208) && PIN_EXISTS(Y_SERIAL_RX)) || ENABLED(IS_TRAMS)
tmc_report_otpw(stepperY, TMC_Y);
#endif
#if ENABLED(Y2_IS_TMC2130) || (ENABLED(Y2_IS_TMC2208) && PIN_EXISTS(Y2_SERIAL_RX))
tmc_report_otpw(stepperY2, TMC_Y2);
#endif
#if ENABLED(Z_IS_TMC2130) || (ENABLED(Z_IS_TMC2208) && PIN_EXISTS(Z_SERIAL_RX)) || ENABLED(IS_TRAMS)
tmc_report_otpw(stepperZ, TMC_Z);
#endif
#if ENABLED(Z2_IS_TMC2130) || (ENABLED(Z2_IS_TMC2208) && PIN_EXISTS(Z2_SERIAL_RX))
tmc_report_otpw(stepperZ2, TMC_Z2);
#endif
#if ENABLED(E0_IS_TMC2130) || (ENABLED(E0_IS_TMC2208) && PIN_EXISTS(E0_SERIAL_RX)) || ENABLED(IS_TRAMS)
tmc_report_otpw(stepperE0, TMC_E0);
#endif
#if ENABLED(E1_IS_TMC2130) || (ENABLED(E1_IS_TMC2208) && PIN_EXISTS(E1_SERIAL_RX))
tmc_report_otpw(stepperE1, TMC_E1);
#endif
#if ENABLED(E2_IS_TMC2130) || (ENABLED(E2_IS_TMC2208) && PIN_EXISTS(E2_SERIAL_RX))
tmc_report_otpw(stepperE2, TMC_E2);
#endif
#if ENABLED(E3_IS_TMC2130) || (ENABLED(E3_IS_TMC2208) && PIN_EXISTS(E3_SERIAL_RX))
tmc_report_otpw(stepperE3, TMC_E3);
#endif
#if ENABLED(E4_IS_TMC2130) || (ENABLED(E4_IS_TMC2208) && PIN_EXISTS(E4_SERIAL_RX))
tmc_report_otpw(stepperE4, TMC_E4);
#endif
}
/**
* M912: Clear TMC stepper driver overtemperature pre-warn flag held by the library
* Specify one or more axes with X, Y, Z, X1, Y1, Z1, X2, Y2, Z2, and E[index].
* If no axes are given, clear all.
*
* Examples:
* M912 X ; clear X and X2
* M912 X1 ; clear X1 only
* M912 X2 ; clear X2 only
* M912 X E ; clear X, X2, and all E
* M912 E1 ; clear E1 only
*/
void GcodeSuite::M912() {
const bool clearX = parser.seen(axis_codes[X_AXIS]), clearY = parser.seen(axis_codes[Y_AXIS]), clearZ = parser.seen(axis_codes[Z_AXIS]), clearE = parser.seen(axis_codes[E_AXIS]),
clearAll = (!clearX && !clearY && !clearZ && !clearE) || (clearX && clearY && clearZ && clearE);
#if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX))
if (clearX || clearAll) tmc_clear_otpw(stepperX, TMC_X);
const bool hasX = parser.seen(axis_codes[X_AXIS]), hasY = parser.seen(axis_codes[Y_AXIS]),
hasZ = parser.seen(axis_codes[Z_AXIS]), hasE = parser.seen(axis_codes[E_AXIS]),
hasNone = !hasX && !hasY && !hasZ && !hasE;
const uint8_t xval = parser.byteval(axis_codes[X_AXIS], 10), yval = parser.byteval(axis_codes[Y_AXIS], 10),
zval = parser.byteval(axis_codes[Z_AXIS], 10), eval = parser.byteval(axis_codes[E_AXIS], 10);
#if (ENABLED(X_IS_TMC2130) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX)) || ENABLED(IS_TRAMS))
if (hasNone || xval == 1 || (hasX && xval == 10)) tmc_clear_otpw(stepperX, TMC_X);
#endif
#if ENABLED(X2_IS_TMC2130) || (ENABLED(X2_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX))
if (clearX || clearAll) tmc_clear_otpw(stepperX, TMC_X);
#if (ENABLED(X2_IS_TMC2130) || (ENABLED(X2_IS_TMC2208) && PIN_EXISTS(X2_SERIAL_RX)))
if (hasNone || xval == 2 || (hasX && xval == 10)) tmc_clear_otpw(stepperX2, TMC_X2);
#endif
#if ENABLED(Y_IS_TMC2130) || (ENABLED(Y_IS_TMC2208) && PIN_EXISTS(Y_SERIAL_RX))
if (clearY || clearAll) tmc_clear_otpw(stepperY, TMC_Y);
#if (ENABLED(Y_IS_TMC2130) || (ENABLED(Y_IS_TMC2208) && PIN_EXISTS(Y_SERIAL_RX)) || ENABLED(IS_TRAMS))
if (hasNone || yval == 1 || (hasY && yval == 10)) tmc_clear_otpw(stepperY, TMC_Y);
#endif
#if ENABLED(Z_IS_TMC2130) || (ENABLED(Z_IS_TMC2208) && PIN_EXISTS(Z_SERIAL_RX))
if (clearZ || clearAll) tmc_clear_otpw(stepperZ, TMC_Z);
#if (ENABLED(Y2_IS_TMC2130) || (ENABLED(Y2_IS_TMC2208) && PIN_EXISTS(Y2_SERIAL_RX)))
if (hasNone || yval == 2 || (hasY && yval == 10)) tmc_clear_otpw(stepperY2, TMC_Y2);
#endif
#if ENABLED(E0_IS_TMC2130) || (ENABLED(E0_IS_TMC2208) && PIN_EXISTS(E0_SERIAL_RX))
if (clearE || clearAll) tmc_clear_otpw(stepperE0, TMC_E0);
#if (ENABLED(Z_IS_TMC2130) || (ENABLED(Z_IS_TMC2208) && PIN_EXISTS(Z_SERIAL_RX)) || ENABLED(IS_TRAMS))
if (hasNone || zval == 1 || (hasZ && zval == 10)) tmc_clear_otpw(stepperZ, TMC_Z);
#endif
#if (ENABLED(Z2_IS_TMC2130) || (ENABLED(Z2_IS_TMC2208) && PIN_EXISTS(Z2_SERIAL_RX)))
if (hasNone || zval == 2 || (hasZ && zval == 10)) tmc_clear_otpw(stepperZ2, TMC_Z2);
#endif
#if (ENABLED(E0_IS_TMC2130) || (ENABLED(E0_IS_TMC2208) && PIN_EXISTS(E0_SERIAL_RX)) || ENABLED(IS_TRAMS))
if (hasNone || eval == 0 || (hasE && eval == 10)) tmc_clear_otpw(stepperE0, TMC_E0);
#endif
#if E_STEPPERS > 1 && (ENABLED(E1_IS_TMC2130) || (ENABLED(E1_IS_TMC2208) && PIN_EXISTS(E1_SERIAL_RX)))
if (hasNone || eval == 1 || (hasE && eval == 10)) tmc_clear_otpw(stepperE1, TMC_E1);
#endif
#if E_STEPPERS > 2 && (ENABLED(E2_IS_TMC2130) || (ENABLED(E2_IS_TMC2208) && PIN_EXISTS(E2_SERIAL_RX)))
if (hasNone || eval == 2 || (hasE && eval == 10)) tmc_clear_otpw(stepperE2, TMC_E2);
#endif
#if E_STEPPERS > 3 && (ENABLED(E3_IS_TMC2130) || (ENABLED(E3_IS_TMC2208) && PIN_EXISTS(E3_SERIAL_RX)))
if (hasNone || eval == 3 || (hasE && eval == 10)) tmc_clear_otpw(stepperE3, TMC_E3);
#endif
#if E_STEPPERS > 4 && (ENABLED(E4_IS_TMC2130) || (ENABLED(E4_IS_TMC2208) && PIN_EXISTS(E4_SERIAL_RX)))
if (hasNone || eval == 4 || (hasE && eval == 10)) tmc_clear_otpw(stepperE4, TMC_E4);
#endif
}

Loading…
Cancel
Save