Add support for Triple-Z steppers/endstops

This commit is contained in:
Holger Müller
2018-06-19 18:55:49 +02:00
committed by Scott Lahteine
parent bc06406d7d
commit 1a6f2b29b8
37 changed files with 901 additions and 155 deletions

View File

@ -50,6 +50,9 @@ void controllerfan_update() {
#if HAS_Z2_ENABLE
|| Z2_ENABLE_READ == Z_ENABLE_ON
#endif
#if HAS_Z3_ENABLE
|| Z3_ENABLE_READ == Z_ENABLE_ON
#endif
|| E0_ENABLE_READ == E_ENABLE_ON
#if E_STEPPERS > 1
|| E1_ENABLE_READ == E_ENABLE_ON

View File

@ -189,6 +189,10 @@ bool report_tmc_status = false;
static uint8_t z2_otpw_cnt = 0;
monitor_tmc_driver(stepperZ2, TMC_Z, z2_otpw_cnt);
#endif
#if HAS_HW_COMMS(Z3)
static uint8_t z3_otpw_cnt = 0;
monitor_tmc_driver(stepperZ3, TMC_Z, z3_otpw_cnt);
#endif
#if HAS_HW_COMMS(E0)
static uint8_t e0_otpw_cnt = 0;
monitor_tmc_driver(stepperE0, TMC_E0, e0_otpw_cnt);
@ -217,12 +221,65 @@ bool report_tmc_status = false;
#endif // MONITOR_DRIVER_STATUS
void _tmc_say_axis(const TMC_AxisEnum axis) {
static const char ext_X[] PROGMEM = "X", ext_Y[] PROGMEM = "Y", ext_Z[] PROGMEM = "Z",
ext_X2[] PROGMEM = "X2", ext_Y2[] PROGMEM = "Y2", ext_Z2[] PROGMEM = "Z2",
ext_E0[] PROGMEM = "E0", ext_E1[] PROGMEM = "E1",
ext_E2[] PROGMEM = "E2", ext_E3[] PROGMEM = "E3",
ext_E4[] PROGMEM = "E4";
static const char* const tmc_axes[] PROGMEM = { ext_X, ext_Y, ext_Z, ext_X2, ext_Y2, ext_Z2, ext_E0, ext_E1, ext_E2, ext_E3, ext_E4 };
static const char ext_X[] PROGMEM = "X", ext_Y[] PROGMEM = "Y", ext_Z[] PROGMEM = "Z",
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS)
, ext_X2[] PROGMEM = "X2"
#endif
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
, ext_Y2[] PROGMEM = "Y2"
#endif
#if Z_MULTI_STEPPER_DRIVERS
, ext_Z2[] PROGMEM = "Z2"
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
, ext_Z3[] PROGMEM = "Z3"
#endif
#endif
#if E_STEPPERS
, ext_E0[] PROGMEM = "E0"
#if E_STEPPERS > 1
, ext_E1[] PROGMEM = "E1"
#if E_STEPPERS > 2
, ext_E2[] PROGMEM = "E2"
#if E_STEPPERS > 3
, ext_E3[] PROGMEM = "E3"
#if E_STEPPERS > 4
, ext_E4[] PROGMEM = "E4"
#endif
#endif
#endif
#endif
#endif
static const char* const tmc_axes[] PROGMEM = {
ext_X, ext_Y, ext_Z
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS)
, ext_X2
#endif
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
, ext_Y2
#endif
#if Z_MULTI_STEPPER_DRIVERS
, ext_Z2
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
, ext_Z3
#endif
#endif
#if E_STEPPERS
, ext_E0
#if E_STEPPERS > 1
, ext_E1
#if E_STEPPERS > 2
, ext_E2
#if E_STEPPERS > 3
, ext_E3
#if E_STEPPERS > 4
, ext_E4
#endif
#endif
#endif
#endif
#endif
};
serialprintPGM((char*)pgm_read_ptr(&tmc_axes[axis]));
}
@ -440,6 +497,9 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
#if AXIS_IS_TMC(Z2)
tmc_status(stepperZ2, TMC_Z2, i, planner.axis_steps_per_mm[Z_AXIS]);
#endif
#if AXIS_IS_TMC(Z3)
tmc_status(stepperZ3, TMC_Z3, i, planner.axis_steps_per_mm[Z_AXIS]);
#endif
#if AXIS_IS_TMC(E0)
tmc_status(stepperE0, TMC_E0, i, planner.axis_steps_per_mm[E_AXIS]);
@ -497,6 +557,9 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
#if AXIS_IS_TMC(Z2)
tmc_parse_drv_status(stepperZ2, TMC_Z2, i);
#endif
#if AXIS_IS_TMC(Z3)
tmc_parse_drv_status(stepperZ3, TMC_Z3, i);
#endif
#if AXIS_IS_TMC(E0)
tmc_parse_drv_status(stepperE0, TMC_E0, i);
@ -612,6 +675,9 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
#if AXIS_DRIVER_TYPE(Z2, TMC2130)
SET_CS_PIN(Z2);
#endif
#if AXIS_DRIVER_TYPE(Z3, TMC2130)
SET_CS_PIN(Z3);
#endif
#if AXIS_DRIVER_TYPE(E0, TMC2130)
SET_CS_PIN(E0);
#endif

View File

@ -35,7 +35,34 @@
extern bool report_tmc_status;
enum TMC_AxisEnum : char { TMC_X, TMC_Y, TMC_Z, TMC_X2, TMC_Y2, TMC_Z2, TMC_E0, TMC_E1, TMC_E2, TMC_E3, TMC_E4 };
enum TMC_AxisEnum : char {
TMC_X, TMC_Y, TMC_Z
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS)
, TMC_X2
#endif
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
, TMC_Y2
#endif
#if ENABLED(Z_DUAL_STEPPER_DRIVERS)
, TMC_Z2
#endif
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
, TMC_Z3
#endif
, TMC_E0
#if E_STEPPERS > 1
, TMC_E1
#if E_STEPPERS > 2
, TMC_E2
#if E_STEPPERS > 3
, TMC_E3
#if E_STEPPERS > 4
, TMC_E4
#endif
#endif
#endif
#endif
};
constexpr uint32_t _tmc_thrs(const uint16_t msteps, const int32_t thrs, const uint32_t spmm) {
return 12650000UL * msteps / (256 * thrs * spmm);