Add support for Triple-Z steppers/endstops
This commit is contained in:
committed by
Scott Lahteine
parent
bc06406d7d
commit
1a6f2b29b8
@ -64,6 +64,9 @@ void GcodeSuite::M906() {
|
||||
#if AXIS_IS_TMC(Z2)
|
||||
if (index == 1) TMC_SET_CURRENT(Z2);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z3)
|
||||
if (index == 2) TMC_SET_CURRENT(Z3);
|
||||
#endif
|
||||
break;
|
||||
case E_AXIS: {
|
||||
if (get_target_extruder_from_command()) return;
|
||||
@ -107,6 +110,9 @@ void GcodeSuite::M906() {
|
||||
#if AXIS_IS_TMC(Z2)
|
||||
TMC_SAY_CURRENT(Z2);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z3)
|
||||
TMC_SAY_CURRENT(Z3);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E0)
|
||||
TMC_SAY_CURRENT(E0);
|
||||
#endif
|
||||
|
@ -56,6 +56,9 @@ void GcodeSuite::M911() {
|
||||
#if M91x_USE(Z2)
|
||||
tmc_report_otpw(stepperZ2, TMC_Z2);
|
||||
#endif
|
||||
#if M91x_USE(Z3)
|
||||
tmc_report_otpw(stepperZ3, TMC_Z3);
|
||||
#endif
|
||||
#if M91x_USE_E(0)
|
||||
tmc_report_otpw(stepperE0, TMC_E0);
|
||||
#endif
|
||||
@ -75,7 +78,7 @@ void GcodeSuite::M911() {
|
||||
|
||||
/**
|
||||
* 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].
|
||||
* Specify one or more axes with X, Y, Z, X1, Y1, Z1, X2, Y2, Z2, Z3 and E[index].
|
||||
* If no axes are given, clear all.
|
||||
*
|
||||
* Examples:
|
||||
@ -93,51 +96,54 @@ void GcodeSuite::M912() {
|
||||
hasNone = !hasX && !hasY && !hasZ && !hasE;
|
||||
|
||||
#if M91x_USE(X) || M91x_USE(X2)
|
||||
const uint8_t xval = parser.byteval(axis_codes[X_AXIS], 10);
|
||||
const int8_t xval = int8_t(parser.byteval(axis_codes[X_AXIS], 0xFF));
|
||||
#if M91x_USE(X)
|
||||
if (hasNone || xval == 1 || (hasX && xval == 10)) tmc_clear_otpw(stepperX, TMC_X);
|
||||
if (hasNone || xval == 1 || (hasX && xval < 0)) tmc_clear_otpw(stepperX, TMC_X);
|
||||
#endif
|
||||
#if M91x_USE(X2)
|
||||
if (hasNone || xval == 2 || (hasX && xval == 10)) tmc_clear_otpw(stepperX2, TMC_X2);
|
||||
if (hasNone || xval == 2 || (hasX && xval < 0)) tmc_clear_otpw(stepperX2, TMC_X2);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if M91x_USE(Y) || M91x_USE(Y2)
|
||||
const uint8_t yval = parser.byteval(axis_codes[Y_AXIS], 10);
|
||||
const int8_t yval = int8_t(parser.byteval(axis_codes[Y_AXIS], 0xFF));
|
||||
#if M91x_USE(Y)
|
||||
if (hasNone || yval == 1 || (hasY && yval == 10)) tmc_clear_otpw(stepperY, TMC_Y);
|
||||
if (hasNone || yval == 1 || (hasY && yval < 0)) tmc_clear_otpw(stepperY, TMC_Y);
|
||||
#endif
|
||||
#if M91x_USE(Y2)
|
||||
if (hasNone || yval == 2 || (hasY && yval == 10)) tmc_clear_otpw(stepperY2, TMC_Y2);
|
||||
if (hasNone || yval == 2 || (hasY && yval < 0)) tmc_clear_otpw(stepperY2, TMC_Y2);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if M91x_USE(Z) || M91x_USE(Z2)
|
||||
const uint8_t zval = parser.byteval(axis_codes[Z_AXIS], 10);
|
||||
#if M91x_USE(Z) || M91x_USE(Z2) || M91x_USE(Z3)
|
||||
const int8_t zval = int8_t(parser.byteval(axis_codes[Z_AXIS], 0xFF));
|
||||
#if M91x_USE(Z)
|
||||
if (hasNone || zval == 1 || (hasZ && zval == 10)) tmc_clear_otpw(stepperZ, TMC_Z);
|
||||
if (hasNone || zval == 1 || (hasZ && zval < 0)) tmc_clear_otpw(stepperZ, TMC_Z);
|
||||
#endif
|
||||
#if M91x_USE(Z2)
|
||||
if (hasNone || zval == 2 || (hasZ && zval == 10)) tmc_clear_otpw(stepperZ2, TMC_Z2);
|
||||
if (hasNone || zval == 2 || (hasZ && zval < 0)) tmc_clear_otpw(stepperZ2, TMC_Z2);
|
||||
#endif
|
||||
#if M91x_USE(Z3)
|
||||
if (hasNone || zval == 3 || (hasZ && zval < 0)) tmc_clear_otpw(stepperZ3, TMC_Z3);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if M91x_USE_E(0) || M91x_USE_E(1) || M91x_USE_E(2) || M91x_USE_E(3) || M91x_USE_E(4)
|
||||
const uint8_t eval = parser.byteval(axis_codes[E_AXIS], 10);
|
||||
const int8_t eval = int8_t(parser.byteval(axis_codes[E_AXIS], 0xFF));
|
||||
#if M91x_USE_E(0)
|
||||
if (hasNone || eval == 0 || (hasE && eval == 10)) tmc_clear_otpw(stepperE0, TMC_E0);
|
||||
if (hasNone || eval == 0 || (hasE && eval < 0)) tmc_clear_otpw(stepperE0, TMC_E0);
|
||||
#endif
|
||||
#if M91x_USE_E(1)
|
||||
if (hasNone || eval == 1 || (hasE && eval == 10)) tmc_clear_otpw(stepperE1, TMC_E1);
|
||||
if (hasNone || eval == 1 || (hasE && eval < 0)) tmc_clear_otpw(stepperE1, TMC_E1);
|
||||
#endif
|
||||
#if M91x_USE_E(2)
|
||||
if (hasNone || eval == 2 || (hasE && eval == 10)) tmc_clear_otpw(stepperE2, TMC_E2);
|
||||
if (hasNone || eval == 2 || (hasE && eval < 0)) tmc_clear_otpw(stepperE2, TMC_E2);
|
||||
#endif
|
||||
#if M91x_USE_E(3)
|
||||
if (hasNone || eval == 3 || (hasE && eval == 10)) tmc_clear_otpw(stepperE3, TMC_E3);
|
||||
if (hasNone || eval == 3 || (hasE && eval < 0)) tmc_clear_otpw(stepperE3, TMC_E3);
|
||||
#endif
|
||||
#if M91x_USE_E(4)
|
||||
if (hasNone || eval == 4 || (hasE && eval == 10)) tmc_clear_otpw(stepperE4, TMC_E4);
|
||||
if (hasNone || eval == 4 || (hasE && eval < 0)) tmc_clear_otpw(stepperE4, TMC_E4);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@ -178,7 +184,10 @@ void GcodeSuite::M912() {
|
||||
if (index < 2) TMC_SET_PWMTHRS(Z,Z);
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Z2)
|
||||
if (!(index & 1)) TMC_SET_PWMTHRS(Z,Z2);
|
||||
if (index == 0 || index == 2) TMC_SET_PWMTHRS(Z,Z2);
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Z3)
|
||||
if (index == 0 || index == 3) TMC_SET_PWMTHRS(Z,Z3);
|
||||
#endif
|
||||
break;
|
||||
case E_AXIS: {
|
||||
@ -223,6 +232,9 @@ void GcodeSuite::M912() {
|
||||
#if AXIS_HAS_STEALTHCHOP(Z2)
|
||||
TMC_SAY_PWMTHRS(Z,Z2);
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(Z3)
|
||||
TMC_SAY_PWMTHRS(Z,Z3);
|
||||
#endif
|
||||
#if AXIS_HAS_STEALTHCHOP(E0)
|
||||
TMC_SAY_PWMTHRS_E(0);
|
||||
#endif
|
||||
@ -282,7 +294,10 @@ void GcodeSuite::M912() {
|
||||
if (index < 2) TMC_SET_SGT(Z);
|
||||
#endif
|
||||
#if AXIS_HAS_STALLGUARD(Z2)
|
||||
if (!(index & 1)) TMC_SET_SGT(Z2);
|
||||
if (index == 0 || index == 2) TMC_SET_SGT(Z2);
|
||||
#endif
|
||||
#if AXIS_HAS_STALLGUARD(Z3)
|
||||
if (index == 0 || index == 3) TMC_SET_SGT(Z3);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
@ -313,6 +328,9 @@ void GcodeSuite::M912() {
|
||||
#if AXIS_HAS_STALLGUARD(Z2)
|
||||
TMC_SAY_SGT(Z2);
|
||||
#endif
|
||||
#if AXIS_HAS_STALLGUARD(Z3)
|
||||
TMC_SAY_SGT(Z3);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -339,6 +357,10 @@ void GcodeSuite::M912() {
|
||||
const uint16_t Z2_current_1 = stepperZ2.getCurrent();
|
||||
stepperZ2.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER);
|
||||
#endif
|
||||
#if Z3_IS_TRINAMIC
|
||||
const uint16_t Z3_current_1 = stepperZ3.getCurrent();
|
||||
stepperZ3.setCurrent(_rms, R_SENSE, HOLD_MULTIPLIER);
|
||||
#endif
|
||||
|
||||
SERIAL_ECHOPAIR("\nCalibration current: Z", _rms);
|
||||
|
||||
@ -352,6 +374,9 @@ void GcodeSuite::M912() {
|
||||
#if AXIS_IS_TMC(Z2)
|
||||
stepperZ2.setCurrent(Z2_current_1, R_SENSE, HOLD_MULTIPLIER);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(Z3)
|
||||
stepperZ3.setCurrent(Z3_current_1, R_SENSE, HOLD_MULTIPLIER);
|
||||
#endif
|
||||
|
||||
do_blocking_move_to_z(Z_MAX_POS);
|
||||
soft_endstops_enabled = true;
|
||||
|
Reference in New Issue
Block a user