Browse Source

Per-axis TMC hold multiplier (#23345)

vanilla_fb_2.0.x
fflosi 3 years ago
committed by Scott Lahteine
parent
commit
6268795003
  1. 19
      Marlin/Configuration_adv.h
  2. 353
      Marlin/src/inc/Conditionals_post.h
  3. 28
      Marlin/src/module/stepper/trinamic.cpp

19
Marlin/Configuration_adv.h

@ -2690,6 +2690,7 @@
#define X_RSENSE 0.11
#define X_CHAIN_POS -1 // -1..0: Not chained. 1: MCU MOSI connected. 2: Next in chain, ...
//#define X_INTERPOLATE true // Enable to override 'INTERPOLATE' for the X axis
//#define X_HOLD_MULTIPLIER 0.5 // Enable to override 'HOLD_MULTIPLIER' for the X axis
#endif
#if AXIS_IS_TMC(X2)
@ -2699,6 +2700,7 @@
#define X2_RSENSE 0.11
#define X2_CHAIN_POS -1
//#define X2_INTERPOLATE true
//#define X2_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(Y)
@ -2708,6 +2710,7 @@
#define Y_RSENSE 0.11
#define Y_CHAIN_POS -1
//#define Y_INTERPOLATE true
//#define Y_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(Y2)
@ -2717,6 +2720,7 @@
#define Y2_RSENSE 0.11
#define Y2_CHAIN_POS -1
//#define Y2_INTERPOLATE true
//#define Y2_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(Z)
@ -2726,6 +2730,7 @@
#define Z_RSENSE 0.11
#define Z_CHAIN_POS -1
//#define Z_INTERPOLATE true
//#define Z_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(Z2)
@ -2735,6 +2740,7 @@
#define Z2_RSENSE 0.11
#define Z2_CHAIN_POS -1
//#define Z2_INTERPOLATE true
//#define Z2_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(Z3)
@ -2744,6 +2750,7 @@
#define Z3_RSENSE 0.11
#define Z3_CHAIN_POS -1
//#define Z3_INTERPOLATE true
//#define Z3_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(Z4)
@ -2753,6 +2760,7 @@
#define Z4_RSENSE 0.11
#define Z4_CHAIN_POS -1
//#define Z4_INTERPOLATE true
//#define Z4_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(I)
@ -2762,6 +2770,7 @@
#define I_RSENSE 0.11
#define I_CHAIN_POS -1
//#define I_INTERPOLATE true
//#define I_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(J)
@ -2771,6 +2780,7 @@
#define J_RSENSE 0.11
#define J_CHAIN_POS -1
//#define J_INTERPOLATE true
//#define J_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(K)
@ -2780,6 +2790,7 @@
#define K_RSENSE 0.11
#define K_CHAIN_POS -1
//#define K_INTERPOLATE true
//#define K_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(E0)
@ -2788,6 +2799,7 @@
#define E0_RSENSE 0.11
#define E0_CHAIN_POS -1
//#define E0_INTERPOLATE true
//#define E0_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(E1)
@ -2796,6 +2808,7 @@
#define E1_RSENSE 0.11
#define E1_CHAIN_POS -1
//#define E1_INTERPOLATE true
//#define E1_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(E2)
@ -2804,6 +2817,7 @@
#define E2_RSENSE 0.11
#define E2_CHAIN_POS -1
//#define E2_INTERPOLATE true
//#define E2_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(E3)
@ -2812,6 +2826,7 @@
#define E3_RSENSE 0.11
#define E3_CHAIN_POS -1
//#define E3_INTERPOLATE true
//#define E3_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(E4)
@ -2820,6 +2835,7 @@
#define E4_RSENSE 0.11
#define E4_CHAIN_POS -1
//#define E4_INTERPOLATE true
//#define E4_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(E5)
@ -2828,6 +2844,7 @@
#define E5_RSENSE 0.11
#define E5_CHAIN_POS -1
//#define E5_INTERPOLATE true
//#define E5_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(E6)
@ -2836,6 +2853,7 @@
#define E6_RSENSE 0.11
#define E6_CHAIN_POS -1
//#define E6_INTERPOLATE true
//#define E6_HOLD_MULTIPLIER 0.5
#endif
#if AXIS_IS_TMC(E7)
@ -2844,6 +2862,7 @@
#define E7_RSENSE 0.11
#define E7_CHAIN_POS -1
//#define E7_INTERPOLATE true
//#define E7_HOLD_MULTIPLIER 0.5
#endif
/**

353
Marlin/src/inc/Conditionals_post.h

@ -1861,231 +1861,332 @@
#undef Z3_STALL_SENSITIVITY
#undef Z4_STALL_SENSITIVITY
#endif
#if AXIS_IS_TMC(X)
#if defined(X_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(X)
#define X_SENSORLESS 1
#endif
#if defined(X2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(X2)
#define X2_SENSORLESS 1
#endif
#if defined(Y_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y)
#define Y_SENSORLESS 1
#endif
#if defined(Y2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y2)
#define Y2_SENSORLESS 1
#endif
#if defined(Z_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z)
#define Z_SENSORLESS 1
#endif
#if defined(Z2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2)
#define Z2_SENSORLESS 1
#if AXIS_HAS_STEALTHCHOP(X)
#define X_HAS_STEALTHCHOP 1
#endif
#if defined(Z3_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z3)
#define Z3_SENSORLESS 1
#if ENABLED(SPI_ENDSTOPS)
#define X_SPI_SENSORLESS X_SENSORLESS
#endif
#if defined(Z4_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z4)
#define Z4_SENSORLESS 1
#ifndef X_INTERPOLATE
#define X_INTERPOLATE INTERPOLATE
#endif
#if defined(I_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(I)
#define I_SENSORLESS 1
#ifndef X_HOLD_MULTIPLIER
#define X_HOLD_MULTIPLIER HOLD_MULTIPLIER
#endif
#if defined(J_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(J)
#define J_SENSORLESS 1
#ifndef X_SLAVE_ADDRESS
#define X_SLAVE_ADDRESS 0
#endif
#if defined(K_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(K)
#define K_SENSORLESS 1
#endif
#if AXIS_HAS_STEALTHCHOP(X)
#define X_HAS_STEALTHCHOP 1
#if AXIS_IS_TMC(X2)
#if defined(X2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(X2)
#define X2_SENSORLESS 1
#endif
#if AXIS_HAS_STEALTHCHOP(X2)
#define X2_HAS_STEALTHCHOP 1
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
#define Y_HAS_STEALTHCHOP 1
#ifndef X2_INTERPOLATE
#define X2_INTERPOLATE X_INTERPOLATE
#endif
#if AXIS_HAS_STEALTHCHOP(Y2)
#define Y2_HAS_STEALTHCHOP 1
#ifndef X2_HOLD_MULTIPLIER
#define X2_HOLD_MULTIPLIER X_HOLD_MULTIPLIER
#endif
#if AXIS_HAS_STEALTHCHOP(Z)
#define Z_HAS_STEALTHCHOP 1
#ifndef X2_SLAVE_ADDRESS
#define X2_SLAVE_ADDRESS 0
#endif
#if AXIS_HAS_STEALTHCHOP(Z2)
#define Z2_HAS_STEALTHCHOP 1
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
#define Z3_HAS_STEALTHCHOP 1
#if AXIS_IS_TMC(Y)
#if defined(Y_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y)
#define Y_SENSORLESS 1
#endif
#if AXIS_HAS_STEALTHCHOP(Z4)
#define Z4_HAS_STEALTHCHOP 1
#if AXIS_HAS_STEALTHCHOP(Y)
#define Y_HAS_STEALTHCHOP 1
#endif
#if AXIS_HAS_STEALTHCHOP(I)
#define I_HAS_STEALTHCHOP 1
#if ENABLED(SPI_ENDSTOPS)
#define Y_SPI_SENSORLESS Y_SENSORLESS
#endif
#if AXIS_HAS_STEALTHCHOP(J)
#define J_HAS_STEALTHCHOP 1
#ifndef Y_INTERPOLATE
#define Y_INTERPOLATE INTERPOLATE
#endif
#if AXIS_HAS_STEALTHCHOP(K)
#define K_HAS_STEALTHCHOP 1
#ifndef Y_HOLD_MULTIPLIER
#define Y_HOLD_MULTIPLIER HOLD_MULTIPLIER
#endif
#if E_STEPPERS > 0 && AXIS_HAS_STEALTHCHOP(E0)
#define E0_HAS_STEALTHCHOP 1
#ifndef Y_SLAVE_ADDRESS
#define Y_SLAVE_ADDRESS 0
#endif
#if E_STEPPERS > 1 && AXIS_HAS_STEALTHCHOP(E1)
#define E1_HAS_STEALTHCHOP 1
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#if defined(Y2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y2)
#define Y2_SENSORLESS 1
#endif
#if E_STEPPERS > 2 && AXIS_HAS_STEALTHCHOP(E2)
#define E2_HAS_STEALTHCHOP 1
#if AXIS_HAS_STEALTHCHOP(Y2)
#define Y2_HAS_STEALTHCHOP 1
#endif
#if E_STEPPERS > 3 && AXIS_HAS_STEALTHCHOP(E3)
#define E3_HAS_STEALTHCHOP 1
#ifndef Y2_INTERPOLATE
#define Y2_INTERPOLATE Y_INTERPOLATE
#endif
#if E_STEPPERS > 4 && AXIS_HAS_STEALTHCHOP(E4)
#define E4_HAS_STEALTHCHOP 1
#ifndef Y2_HOLD_MULTIPLIER
#define Y2_HOLD_MULTIPLIER Y_HOLD_MULTIPLIER
#endif
#if E_STEPPERS > 5 && AXIS_HAS_STEALTHCHOP(E5)
#define E5_HAS_STEALTHCHOP 1
#ifndef Y2_SLAVE_ADDRESS
#define Y2_SLAVE_ADDRESS 0
#endif
#if E_STEPPERS > 6 && AXIS_HAS_STEALTHCHOP(E6)
#define E6_HAS_STEALTHCHOP 1
#endif
#if E_STEPPERS > 7 && AXIS_HAS_STEALTHCHOP(E7)
#define E7_HAS_STEALTHCHOP 1
#endif
#if ENABLED(SPI_ENDSTOPS)
#define X_SPI_SENSORLESS X_SENSORLESS
#if HAS_Y_AXIS
#define Y_SPI_SENSORLESS Y_SENSORLESS
#if AXIS_IS_TMC(Z)
#if defined(Z_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z)
#define Z_SENSORLESS 1
#endif
#if HAS_Z_AXIS
#if AXIS_HAS_STEALTHCHOP(Z)
#define Z_HAS_STEALTHCHOP 1
#endif
#if ENABLED(SPI_ENDSTOPS)
#define Z_SPI_SENSORLESS Z_SENSORLESS
#endif
#if LINEAR_AXES >= 4
#define I_SPI_SENSORLESS I_SENSORLESS
#ifndef Z_INTERPOLATE
#define Z_INTERPOLATE INTERPOLATE
#endif
#if LINEAR_AXES >= 5
#define J_SPI_SENSORLESS J_SENSORLESS
#ifndef Z_HOLD_MULTIPLIER
#define Z_HOLD_MULTIPLIER HOLD_MULTIPLIER
#endif
#if LINEAR_AXES >= 6
#define K_SPI_SENSORLESS K_SENSORLESS
#ifndef Z_SLAVE_ADDRESS
#define Z_SLAVE_ADDRESS 0
#endif
#if NUM_Z_STEPPER_DRIVERS >= 2
#if defined(Z2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2)
#define Z2_SENSORLESS 1
#endif
#ifndef X_INTERPOLATE
#define X_INTERPOLATE INTERPOLATE
#if AXIS_HAS_STEALTHCHOP(Z2)
#define Z2_HAS_STEALTHCHOP 1
#endif
#ifndef X2_INTERPOLATE
#define X2_INTERPOLATE INTERPOLATE
#ifndef Z2_INTERPOLATE
#define Z2_INTERPOLATE Z_INTERPOLATE
#endif
#ifndef Y_INTERPOLATE
#define Y_INTERPOLATE INTERPOLATE
#ifndef Z2_HOLD_MULTIPLIER
#define Z2_HOLD_MULTIPLIER Z_HOLD_MULTIPLIER
#endif
#ifndef Y2_INTERPOLATE
#define Y2_INTERPOLATE INTERPOLATE
#ifndef Z2_SLAVE_ADDRESS
#define Z2_SLAVE_ADDRESS 0
#endif
#ifndef Z_INTERPOLATE
#define Z_INTERPOLATE INTERPOLATE
#endif
#ifndef Z2_INTERPOLATE
#define Z2_INTERPOLATE INTERPOLATE
#if NUM_Z_STEPPER_DRIVERS >= 3
#if defined(Z3_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z3)
#define Z3_SENSORLESS 1
#endif
#if AXIS_HAS_STEALTHCHOP(Z3)
#define Z3_HAS_STEALTHCHOP 1
#endif
#ifndef Z3_INTERPOLATE
#define Z3_INTERPOLATE INTERPOLATE
#define Z3_INTERPOLATE Z_INTERPOLATE
#endif
#ifndef Z4_INTERPOLATE
#define Z4_INTERPOLATE INTERPOLATE
#ifndef Z3_HOLD_MULTIPLIER
#define Z3_HOLD_MULTIPLIER Z_HOLD_MULTIPLIER
#endif
#if LINEAR_AXES >= 4 && !defined(I_INTERPOLATE)
#define I_INTERPOLATE INTERPOLATE
#ifndef Z3_SLAVE_ADDRESS
#define Z3_SLAVE_ADDRESS 0
#endif
#if LINEAR_AXES >= 5 && !defined(J_INTERPOLATE)
#define J_INTERPOLATE INTERPOLATE
#endif
#if LINEAR_AXES >= 6 && !defined(K_INTERPOLATE)
#define K_INTERPOLATE INTERPOLATE
#if NUM_Z_STEPPER_DRIVERS >= 4
#if defined(Z4_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z4)
#define Z4_SENSORLESS 1
#endif
#ifndef E0_INTERPOLATE
#define E0_INTERPOLATE INTERPOLATE
#if AXIS_HAS_STEALTHCHOP(Z4)
#define Z4_HAS_STEALTHCHOP 1
#endif
#ifndef E1_INTERPOLATE
#define E1_INTERPOLATE INTERPOLATE
#ifndef Z4_INTERPOLATE
#define Z4_INTERPOLATE Z_INTERPOLATE
#endif
#ifndef E2_INTERPOLATE
#define E2_INTERPOLATE INTERPOLATE
#ifndef Z4_HOLD_MULTIPLIER
#define Z4_HOLD_MULTIPLIER Z_HOLD_MULTIPLIER
#endif
#ifndef E3_INTERPOLATE
#define E3_INTERPOLATE INTERPOLATE
#ifndef Z4_SLAVE_ADDRESS
#define Z4_SLAVE_ADDRESS 0
#endif
#ifndef E4_INTERPOLATE
#define E4_INTERPOLATE INTERPOLATE
#endif
#ifndef E5_INTERPOLATE
#define E5_INTERPOLATE INTERPOLATE
#endif
#ifndef E6_INTERPOLATE
#define E6_INTERPOLATE INTERPOLATE
#if AXIS_IS_TMC(I)
#if defined(I_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(I)
#define I_SENSORLESS 1
#endif
#ifndef E7_INTERPOLATE
#define E7_INTERPOLATE INTERPOLATE
#if AXIS_HAS_STEALTHCHOP(I)
#define I_HAS_STEALTHCHOP 1
#endif
#ifndef X_SLAVE_ADDRESS
#define X_SLAVE_ADDRESS 0
#if ENABLED(SPI_ENDSTOPS)
#define I_SPI_SENSORLESS I_SENSORLESS
#endif
#ifndef Y_SLAVE_ADDRESS
#define Y_SLAVE_ADDRESS 0
#ifndef I_INTERPOLATE
#define I_INTERPOLATE INTERPOLATE
#endif
#ifndef Z_SLAVE_ADDRESS
#define Z_SLAVE_ADDRESS 0
#ifndef I_HOLD_MULTIPLIER
#define I_HOLD_MULTIPLIER HOLD_MULTIPLIER
#endif
#ifndef I_SLAVE_ADDRESS
#define I_SLAVE_ADDRESS 0
#endif
#endif
#if AXIS_IS_TMC(J)
#if defined(J_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(J)
#define J_SENSORLESS 1
#endif
#if AXIS_HAS_STEALTHCHOP(J)
#define J_HAS_STEALTHCHOP 1
#endif
#if ENABLED(SPI_ENDSTOPS)
#define J_SPI_SENSORLESS J_SENSORLESS
#endif
#ifndef J_INTERPOLATE
#define J_INTERPOLATE INTERPOLATE
#endif
#ifndef J_HOLD_MULTIPLIER
#define J_HOLD_MULTIPLIER HOLD_MULTIPLIER
#endif
#ifndef J_SLAVE_ADDRESS
#define J_SLAVE_ADDRESS 0
#endif
#endif
#if AXIS_IS_TMC(K)
#if defined(K_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(K)
#define K_SENSORLESS 1
#endif
#if AXIS_HAS_STEALTHCHOP(K)
#define K_HAS_STEALTHCHOP 1
#endif
#if ENABLED(SPI_ENDSTOPS)
#define K_SPI_SENSORLESS K_SENSORLESS
#endif
#ifndef K_INTERPOLATE
#define K_INTERPOLATE INTERPOLATE
#endif
#ifndef K_HOLD_MULTIPLIER
#define K_HOLD_MULTIPLIER HOLD_MULTIPLIER
#endif
#ifndef K_SLAVE_ADDRESS
#define K_SLAVE_ADDRESS 0
#endif
#ifndef X2_SLAVE_ADDRESS
#define X2_SLAVE_ADDRESS 0
#endif
#ifndef Y2_SLAVE_ADDRESS
#define Y2_SLAVE_ADDRESS 0
#if AXIS_IS_TMC(E0)
#if AXIS_HAS_STEALTHCHOP(E0)
#define E0_HAS_STEALTHCHOP 1
#endif
#ifndef Z2_SLAVE_ADDRESS
#define Z2_SLAVE_ADDRESS 0
#ifndef E0_INTERPOLATE
#define E0_INTERPOLATE INTERPOLATE
#endif
#ifndef Z3_SLAVE_ADDRESS
#define Z3_SLAVE_ADDRESS 0
#endif
#ifndef Z4_SLAVE_ADDRESS
#define Z4_SLAVE_ADDRESS 0
#ifndef E0_HOLD_MULTIPLIER
#define E0_HOLD_MULTIPLIER HOLD_MULTIPLIER
#endif
#ifndef E0_SLAVE_ADDRESS
#define E0_SLAVE_ADDRESS 0
#endif
#endif
#if AXIS_IS_TMC(E1)
#if AXIS_HAS_STEALTHCHOP(E1)
#define E1_HAS_STEALTHCHOP 1
#endif
#ifndef E1_INTERPOLATE
#define E1_INTERPOLATE E0_INTERPOLATE
#endif
#ifndef E1_HOLD_MULTIPLIER
#define E1_HOLD_MULTIPLIER E0_HOLD_MULTIPLIER
#endif
#ifndef E1_SLAVE_ADDRESS
#define E1_SLAVE_ADDRESS 0
#endif
#endif
#if AXIS_IS_TMC(E2)
#if AXIS_HAS_STEALTHCHOP(E2)
#define E2_HAS_STEALTHCHOP 1
#endif
#ifndef E2_INTERPOLATE
#define E2_INTERPOLATE E0_INTERPOLATE
#endif
#ifndef E2_HOLD_MULTIPLIER
#define E2_HOLD_MULTIPLIER E0_HOLD_MULTIPLIER
#endif
#ifndef E2_SLAVE_ADDRESS
#define E2_SLAVE_ADDRESS 0
#endif
#endif
#if AXIS_IS_TMC(E3)
#if AXIS_HAS_STEALTHCHOP(E3)
#define E3_HAS_STEALTHCHOP 1
#endif
#ifndef E3_INTERPOLATE
#define E3_INTERPOLATE E0_INTERPOLATE
#endif
#ifndef E3_HOLD_MULTIPLIER
#define E3_HOLD_MULTIPLIER E0_HOLD_MULTIPLIER
#endif
#ifndef E3_SLAVE_ADDRESS
#define E3_SLAVE_ADDRESS 0
#endif
#endif
#if AXIS_IS_TMC(E4)
#if AXIS_HAS_STEALTHCHOP(E4)
#define E4_HAS_STEALTHCHOP 1
#endif
#ifndef E4_INTERPOLATE
#define E4_INTERPOLATE E0_INTERPOLATE
#endif
#ifndef E4_HOLD_MULTIPLIER
#define E4_HOLD_MULTIPLIER E0_HOLD_MULTIPLIER
#endif
#ifndef E4_SLAVE_ADDRESS
#define E4_SLAVE_ADDRESS 0
#endif
#endif
#if AXIS_IS_TMC(E5)
#if AXIS_HAS_STEALTHCHOP(E5)
#define E5_HAS_STEALTHCHOP 1
#endif
#ifndef E5_INTERPOLATE
#define E5_INTERPOLATE E0_INTERPOLATE
#endif
#ifndef E5_HOLD_MULTIPLIER
#define E5_HOLD_MULTIPLIER E0_HOLD_MULTIPLIER
#endif
#ifndef E5_SLAVE_ADDRESS
#define E5_SLAVE_ADDRESS 0
#endif
#endif
#if AXIS_IS_TMC(E6)
#if AXIS_HAS_STEALTHCHOP(E6)
#define E6_HAS_STEALTHCHOP 1
#endif
#ifndef E6_INTERPOLATE
#define E6_INTERPOLATE E0_INTERPOLATE
#endif
#ifndef E6_HOLD_MULTIPLIER
#define E6_HOLD_MULTIPLIER E0_HOLD_MULTIPLIER
#endif
#ifndef E6_SLAVE_ADDRESS
#define E6_SLAVE_ADDRESS 0
#endif
#endif
#if AXIS_IS_TMC(E7)
#if AXIS_HAS_STEALTHCHOP(E7)
#define E7_HAS_STEALTHCHOP 1
#endif
#ifndef E7_INTERPOLATE
#define E7_INTERPOLATE E0_INTERPOLATE
#endif
#ifndef E7_HOLD_MULTIPLIER
#define E7_HOLD_MULTIPLIER E0_HOLD_MULTIPLIER
#endif
#ifndef E7_SLAVE_ADDRESS
#define E7_SLAVE_ADDRESS 0
#endif
#endif
#endif
#endif // HAS_TRINAMIC_CONFIG
#if ANY_AXIS_HAS(HW_SERIAL)
#define HAS_TMC_HW_SERIAL 1

28
Marlin/src/module/stepper/trinamic.cpp

@ -38,7 +38,7 @@
enum StealthIndex : uint8_t {
LOGICAL_AXIS_LIST(STEALTH_AXIS_E, STEALTH_AXIS_X, STEALTH_AXIS_Y, STEALTH_AXIS_Z, STEALTH_AXIS_I, STEALTH_AXIS_J, STEALTH_AXIS_K)
};
#define TMC_INIT(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, stealthchop_by_axis[STEALTH_INDEX], chopper_timing_##ST, ST##_INTERPOLATE)
#define TMC_INIT(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, stealthchop_by_axis[STEALTH_INDEX], chopper_timing_##ST, ST##_INTERPOLATE, ST##_HOLD_MULTIPLIER)
// IC = TMC model number
// ST = Stepper object letter
@ -200,7 +200,7 @@ enum StealthIndex : uint8_t {
#if HAS_DRIVER(TMC2130)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
void tmc_init(TMCMarlin<TMC2130Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) {
void tmc_init(TMCMarlin<TMC2130Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate, float hold_multiplier) {
st.begin();
CHOPCONF_t chopconf{0};
@ -212,7 +212,7 @@ enum StealthIndex : uint8_t {
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
st.CHOPCONF(chopconf.sr);
st.rms_current(mA, HOLD_MULTIPLIER);
st.rms_current(mA, hold_multiplier);
st.microsteps(microsteps);
st.iholddelay(10);
st.TPOWERDOWN(128); // ~2s until driver lowers to hold current
@ -235,7 +235,7 @@ enum StealthIndex : uint8_t {
#if HAS_DRIVER(TMC2160)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
void tmc_init(TMCMarlin<TMC2160Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) {
void tmc_init(TMCMarlin<TMC2160Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate, float hold_multiplier) {
st.begin();
CHOPCONF_t chopconf{0};
@ -247,7 +247,7 @@ enum StealthIndex : uint8_t {
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
st.CHOPCONF(chopconf.sr);
st.rms_current(mA, HOLD_MULTIPLIER);
st.rms_current(mA, hold_multiplier);
st.microsteps(microsteps);
st.iholddelay(10);
st.TPOWERDOWN(128); // ~2s until driver lowers to hold current
@ -604,7 +604,7 @@ enum StealthIndex : uint8_t {
#if HAS_DRIVER(TMC2208)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
void tmc_init(TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) {
void tmc_init(TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate, float hold_multiplier) {
TMC2208_n::GCONF_t gconf{0};
gconf.pdn_disable = true; // Use UART
gconf.mstep_reg_select = true; // Select microsteps with UART
@ -622,7 +622,7 @@ enum StealthIndex : uint8_t {
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
st.CHOPCONF(chopconf.sr);
st.rms_current(mA, HOLD_MULTIPLIER);
st.rms_current(mA, hold_multiplier);
st.microsteps(microsteps);
st.iholddelay(10);
st.TPOWERDOWN(128); // ~2s until driver lowers to hold current
@ -646,7 +646,7 @@ enum StealthIndex : uint8_t {
#if HAS_DRIVER(TMC2209)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
void tmc_init(TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) {
void tmc_init(TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate, float hold_multiplier) {
TMC2208_n::GCONF_t gconf{0};
gconf.pdn_disable = true; // Use UART
gconf.mstep_reg_select = true; // Select microsteps with UART
@ -664,7 +664,7 @@ enum StealthIndex : uint8_t {
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
st.CHOPCONF(chopconf.sr);
st.rms_current(mA, HOLD_MULTIPLIER);
st.rms_current(mA, hold_multiplier);
st.microsteps(microsteps);
st.iholddelay(10);
st.TPOWERDOWN(128); // ~2s until driver lowers to hold current
@ -688,7 +688,7 @@ enum StealthIndex : uint8_t {
#if HAS_DRIVER(TMC2660)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
void tmc_init(TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t, const bool, const chopper_timing_t &chop_init, const bool interpolate) {
void tmc_init(TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t, const bool, const chopper_timing_t &chop_init, const bool interpolate, float hold_multiplier) {
st.begin();
TMC2660_n::CHOPCONF_t chopconf{0};
@ -710,7 +710,7 @@ enum StealthIndex : uint8_t {
#if HAS_DRIVER(TMC5130)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
void tmc_init(TMCMarlin<TMC5130Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) {
void tmc_init(TMCMarlin<TMC5130Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate, float hold_multiplier) {
st.begin();
CHOPCONF_t chopconf{0};
@ -722,7 +722,7 @@ enum StealthIndex : uint8_t {
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
st.CHOPCONF(chopconf.sr);
st.rms_current(mA, HOLD_MULTIPLIER);
st.rms_current(mA, hold_multiplier);
st.microsteps(microsteps);
st.iholddelay(10);
st.TPOWERDOWN(128); // ~2s until driver lowers to hold current
@ -745,7 +745,7 @@ enum StealthIndex : uint8_t {
#if HAS_DRIVER(TMC5160)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
void tmc_init(TMCMarlin<TMC5160Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) {
void tmc_init(TMCMarlin<TMC5160Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate, float hold_multiplier) {
st.begin();
CHOPCONF_t chopconf{0};
@ -757,7 +757,7 @@ enum StealthIndex : uint8_t {
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
st.CHOPCONF(chopconf.sr);
st.rms_current(mA, HOLD_MULTIPLIER);
st.rms_current(mA, hold_multiplier);
st.microsteps(microsteps);
st.iholddelay(10);
st.TPOWERDOWN(128); // ~2s until driver lowers to hold current

Loading…
Cancel
Save