mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-27 05:48:43 +00:00
Support all axes in M911 and M912 (#10669)
Co-Authored-By: Giuliano <gmagician@users.noreply.github.com>
This commit is contained in:
parent
98bb97b515
commit
2c01e9c6a7
@ -10932,7 +10932,7 @@ inline void gcode_M502() {
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
inline void gcode_M911() {
|
||||
#if ENABLED(X_IS_TMC2130) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX)) || ENABLED(IS_TRAMS)
|
||||
@ -10944,34 +10944,83 @@ inline void gcode_M502() {
|
||||
#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(X2_IS_TMC2130) || (ENABLED(X2_IS_TMC2208) && PIN_EXISTS(X2_SERIAL_RX))
|
||||
tmc_report_otpw(stepperX2, TMC_X2);
|
||||
#endif
|
||||
#if ENABLED(Y2_IS_TMC2130) || (ENABLED(Y2_IS_TMC2208) && PIN_EXISTS(Y2_SERIAL_RX))
|
||||
tmc_report_otpw(stepperY2, TMC_Y2);
|
||||
#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
|
||||
*/
|
||||
inline void gcode_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);
|
||||
#endif
|
||||
#if ENABLED(X2_IS_TMC2130) || (ENABLED(X2_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX))
|
||||
if (clearX || clearAll) tmc_clear_otpw(stepperX, TMC_X);
|
||||
#endif
|
||||
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(Y_IS_TMC2130) || (ENABLED(Y_IS_TMC2208) && PIN_EXISTS(Y_SERIAL_RX))
|
||||
if (clearY || clearAll) tmc_clear_otpw(stepperY, TMC_Y);
|
||||
#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(Z_IS_TMC2130) || (ENABLED(Z_IS_TMC2208) && PIN_EXISTS(Z_SERIAL_RX))
|
||||
if (clearZ || clearAll) tmc_clear_otpw(stepperZ, TMC_Z);
|
||||
#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(E0_IS_TMC2130) || (ENABLED(E0_IS_TMC2208) && PIN_EXISTS(E0_SERIAL_RX))
|
||||
if (clearE || clearAll) tmc_clear_otpw(stepperE0, TMC_E0);
|
||||
#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(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(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…
Reference in New Issue
Block a user