Revert "Coolstep for TMC2130, 2209, 5130, 5160"

Reverting #16790 as not ready for primetime.
2.0.x
Scott Lahteine 5 years ago
parent 28b48fc9bb
commit 18a7276909

@ -2275,166 +2275,6 @@
#define E6_HYBRID_THRESHOLD 30 #define E6_HYBRID_THRESHOLD 30
#define E7_HYBRID_THRESHOLD 30 #define E7_HYBRID_THRESHOLD 30
/**
* CoolStep. Currently supported for TMC2130, TMC2209, TMC5130 and TMC5160 only.
* This mode allows for cooler steppers and energy savings.
* The driver will switch to coolStep when stepper speed is over COOLSTEP_THRESHOLD mm/s.
*
* If SG_RESULT goes below COOLSTEP_LOWER_LOAD_THRESHOLD * 32 stepper current will be increased.
* Set to 0 to disable CoolStep.
*
* If SG_RESULT goes above (COOLSTEP_LOWER_LOAD_THRESHOLD + COOLSTEP_UPPER_LOAD_THRESHOLD + 1) * 32
* stepper current will be decreased.
*
* SEUP sets the increase step width. Value range is 0..3 and computed as 2^SEUP.
* SEDN sets the decrease delay. Value range is 0..3, 0 being the slowest.
* SEIMIN sets the lower current limit. 0: 1/2 of IRUN, 1:1/4 of IRUN
*/
#if AXIS_HAS_COOLSTEP(X)
#define X_COOLSTEP_SPEED_THRESHOLD 5
#define X_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define X_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define X_COOLSTEP_SEUP 2
#define X_COOLSTEP_SEDN 0
#define X_COOLSTEP_SEIMIN 1
#endif
#if AXIS_HAS_COOLSTEP(X2)
#define X2_COOLSTEP_SPEED_THRESHOLD 5
#define X2_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define X2_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define X2_COOLSTEP_SEUP 2
#define X2_COOLSTEP_SEDN 0
#define X2_COOLSTEP_SEIMIN 1
#endif
#if AXIS_HAS_COOLSTEP(Y)
#define Y_COOLSTEP_SPEED_THRESHOLD 5
#define Y_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define Y_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define Y_COOLSTEP_SEUP 2
#define Y_COOLSTEP_SEDN 0
#define Y_COOLSTEP_SEIMIN 1
#endif
#if AXIS_HAS_COOLSTEP(Y2)
#define Y2_COOLSTEP_SPEED_THRESHOLD 5
#define Y2_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define Y2_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define Y2_COOLSTEP_SEUP 2
#define Y2_COOLSTEP_SEDN 0
#define Y2_COOLSTEP_SEIMIN 1
#endif
#if AXIS_HAS_COOLSTEP(Z)
#define Z_COOLSTEP_SPEED_THRESHOLD 5
#define Z_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define Z_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define Z_COOLSTEP_SEUP 2
#define Z_COOLSTEP_SEDN 0
#define Z_COOLSTEP_SEIMIN 1
#endif
#if AXIS_HAS_COOLSTEP(Z2)
#define Z2_COOLSTEP_SPEED_THRESHOLD 5
#define Z2_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define Z2_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define Z2_COOLSTEP_SEUP 2
#define Z2_COOLSTEP_SEDN 0
#define Z2_COOLSTEP_SEIMIN 1
#endif
#if AXIS_HAS_COOLSTEP(Z3)
#define Z3_COOLSTEP_SPEED_THRESHOLD 5
#define Z3_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define Z3_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define Z3_COOLSTEP_SEUP 2
#define Z3_COOLSTEP_SEDN 0
#define Z3_COOLSTEP_SEIMIN 1
#endif
#if AXIS_HAS_COOLSTEP(Z4)
#define Z4_COOLSTEP_SPEED_THRESHOLD 5
#define Z4_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define Z4_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define Z4_COOLSTEP_SEUP 2
#define Z4_COOLSTEP_SEDN 0
#define Z4_COOLSTEP_SEIMIN 1
#endif
#if AXIS_HAS_COOLSTEP(E0)
#define E0_COOLSTEP_SPEED_THRESHOLD 5
#define E0_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define E0_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define E0_COOLSTEP_SEUP 2
#define E0_COOLSTEP_SEDN 0
#define E0_COOLSTEP_SEIMIN 1
#endif
#if AXIS_HAS_COOLSTEP(E1)
#define E1_COOLSTEP_SPEED_THRESHOLD 5
#define E1_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define E1_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define E1_COOLSTEP_SEUP 2
#define E1_COOLSTEP_SEDN 0
#define E1_COOLSTEP_SEIMIN 1
#endif
#if AXIS_HAS_COOLSTEP(E2)
#define E2_COOLSTEP_SPEED_THRESHOLD 5
#define E2_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define E2_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define E2_COOLSTEP_SEUP 2
#define E2_COOLSTEP_SEDN 0
#define E2_COOLSTEP_SEIMIN 1
#endif
#if AXIS_HAS_COOLSTEP(E3)
#define E3_COOLSTEP_SPEED_THRESHOLD 5
#define E3_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define E3_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define E3_COOLSTEP_SEUP 2
#define E3_COOLSTEP_SEDN 0
#define E3_COOLSTEP_SEIMIN 1
#endif
#if AXIS_HAS_COOLSTEP(E4)
#define E4_COOLSTEP_SPEED_THRESHOLD 5
#define E4_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define E4_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define E4_COOLSTEP_SEUP 2
#define E4_COOLSTEP_SEDN 0
#define E4_COOLSTEP_SEIMIN 1
#endif
#if AXIS_HAS_COOLSTEP(E5)
#define E5_COOLSTEP_SPEED_THRESHOLD 5
#define E5_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define E5_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define E5_COOLSTEP_SEUP 2
#define E5_COOLSTEP_SEDN 0
#define E5_COOLSTEP_SEIMIN 1
#endif
#if AXIS_HAS_COOLSTEP(E6)
#define E6_COOLSTEP_SPEED_THRESHOLD 5
#define E6_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define E6_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define E6_COOLSTEP_SEUP 2
#define E6_COOLSTEP_SEDN 0
#define E6_COOLSTEP_SEIMIN 1
#endif
#if AXIS_HAS_COOLSTEP(E7)
#define E7_COOLSTEP_SPEED_THRESHOLD 5
#define E7_COOLSTEP_LOWER_LOAD_THRESHOLD 7
#define E7_COOLSTEP_UPPER_LOAD_THRESHOLD 0
#define E7_COOLSTEP_SEUP 2
#define E7_COOLSTEP_SEDN 0
#define E7_COOLSTEP_SEIMIN 1
#endif
/** /**
* Use StallGuard2 to home / probe X, Y, Z. * Use StallGuard2 to home / probe X, Y, Z.
* *

@ -137,13 +137,6 @@ class TMCMarlin : public TMC, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
#endif #endif
#endif #endif
uint32_t get_cool_thrs() {
return _tmc_thrs(this->microsteps(), this->TCOOLTHRS(), planner.settings.axis_steps_per_mm[AXIS_ID]);
}
void set_cool_thrs(const uint32_t thrs) {
TMC::TCOOLTHRS(_tmc_thrs(this->microsteps(), thrs, planner.settings.axis_steps_per_mm[AXIS_ID]));
}
#if HAS_LCD_MENU #if HAS_LCD_MENU
inline void refresh_stepper_current() { rms_current(this->val_mA); } inline void refresh_stepper_current() { rms_current(this->val_mA); }
@ -240,14 +233,6 @@ class TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
#endif #endif
} }
#endif #endif
uint32_t get_cool_thrs() {
return _tmc_thrs(this->microsteps(), this->TCOOLTHRS(), planner.settings.axis_steps_per_mm[AXIS_ID]);
}
void set_cool_thrs(const uint32_t thrs) {
TMC2209Stepper::TCOOLTHRS(_tmc_thrs(this->microsteps(), thrs, planner.settings.axis_steps_per_mm[AXIS_ID]));
}
#if USE_SENSORLESS #if USE_SENSORLESS
inline int16_t homing_threshold() { return TMC2209Stepper::SGTHRS(); } inline int16_t homing_threshold() { return TMC2209Stepper::SGTHRS(); }
void homing_threshold(int16_t sgt_val) { void homing_threshold(int16_t sgt_val) {
@ -261,6 +246,7 @@ class TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
#if HAS_LCD_MENU #if HAS_LCD_MENU
inline void refresh_stepper_current() { rms_current(this->val_mA); } inline void refresh_stepper_current() { rms_current(this->val_mA); }
#if ENABLED(HYBRID_THRESHOLD) #if ENABLED(HYBRID_THRESHOLD)
inline void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); } inline void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
#endif #endif

@ -2040,62 +2040,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "LED_USER_PRESET_STARTUP is required for FYSETC_MINI_12864 2.x displays." #error "LED_USER_PRESET_STARTUP is required for FYSETC_MINI_12864 2.x displays."
#endif #endif
/**
* Make sure CoolStep settings exist
*/
#if HAS_COOLSTEP
#define NEEDS_COOLSTEP(A) AXIS_HAS_COOLSTEP(A) && !(defined(A##_COOLSTEP_SPEED_THRESHOLD) && defined(A##_COOLSTEP_LOWER_LOAD_THRESHOLD) && defined(A##_COOLSTEP_UPPER_LOAD_THRESHOLD) && defined(A##_COOLSTEP_SEUP) && defined(A##_COOLSTEP_SEDN) && defined(A##_COOLSTEP_SEIMIN))
#if NEEDS_COOLSTEP(X)
#error "X COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#if NEEDS_COOLSTEP(X2)
#error "X2 COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#if NEEDS_COOLSTEP(Y)
#error "Y COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#if NEEDS_COOLSTEP(Y2)
#error "Y2 COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#if NEEDS_COOLSTEP(Z)
#error "Z COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#if NEEDS_COOLSTEP(Z2)
#error "Z2 COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#if NEEDS_COOLSTEP(Z3)
#error "Z3 COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#if NEEDS_COOLSTEP(Z4)
#error "Z4 COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#if NEEDS_COOLSTEP(E0)
#error "E0 COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#if NEEDS_COOLSTEP(E1)
#error "E1 COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#if NEEDS_COOLSTEP(E2)
#error "E2 COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#if NEEDS_COOLSTEP(E3)
#error "E3 COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#if NEEDS_COOLSTEP(E4)
#error "E4 COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#if NEEDS_COOLSTEP(E5)
#error "E5 COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#if NEEDS_COOLSTEP(E6)
#error "E6 COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#if NEEDS_COOLSTEP(E7)
#error "E7 COOLSTEP settings must be defined in Configuration_adv.h."
#endif
#undef NEEDS_COOLSTEP
#endif
/** /**
* Check existing CS pins against enabled TMC SPI drivers. * Check existing CS pins against enabled TMC SPI drivers.
*/ */

@ -36,19 +36,7 @@
#include <SPI.h> #include <SPI.h>
enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#define _TMC_INIT_1(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS) #define TMC_INIT(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, stealthchop_by_axis[STEALTH_INDEX])
#define _TMC_INIT_2(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, stealthchop_by_axis[STEALTH_INDEX], ST##_HYBRID_THRESHOLD)
#define _TMC_INIT_3(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, stealthchop_by_axis[STEALTH_INDEX], ST##_HYBRID_THRESHOLD, ST##_COOLSTEP_SPEED_THRESHOLD, ST##_COOLSTEP_LOWER_LOAD_THRESHOLD, ST##_COOLSTEP_UPPER_LOAD_THRESHOLD, ST##_COOLSTEP_SEUP, ST##_COOLSTEP_SEDN, ST##_COOLSTEP_SEIMIN)
#define _TMC_INIT_TMC2660(ST, STEALTH_INDEX) _TMC_INIT_1(ST, STEALTH_INDEX)
#define _TMC_INIT_TMC2160(ST, STEALTH_INDEX) _TMC_INIT_2(ST, STEALTH_INDEX)
#define _TMC_INIT_TMC2208(ST, STEALTH_INDEX) _TMC_INIT_2(ST, STEALTH_INDEX)
#define _TMC_INIT_TMC5130(ST, STEALTH_INDEX) _TMC_INIT_3(ST, STEALTH_INDEX)
#define _TMC_INIT_TMC5160(ST, STEALTH_INDEX) _TMC_INIT_3(ST, STEALTH_INDEX)
#define _TMC_INIT_TMC2130(ST, STEALTH_INDEX) _TMC_INIT_3(ST, STEALTH_INDEX)
#define _TMC_INIT_TMC2209(ST, STEALTH_INDEX) _TMC_INIT_3(ST, STEALTH_INDEX)
#define __TMC_INIT(DRV, ST, STEALTH_INDEX) _TMC_INIT_##DRV(ST, STEALTH_INDEX)
#define _TMC_INIT(DRV, ST, STEALTH_INDEX) __TMC_INIT(DRV, ST, STEALTH_INDEX)
#define TMC_INIT(ST, STEALTH_INDEX) _TMC_INIT(ST##_DRIVER_TYPE, ST, STEALTH_INDEX)
// IC = TMC model number // IC = TMC model number
// ST = Stepper object letter // ST = Stepper object letter
@ -134,19 +122,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#if HAS_DRIVER(TMC2130) #if HAS_DRIVER(TMC2130)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID> template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
void tmc_init( 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) {
TMCMarlin<TMC2130Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st,
const uint16_t mA,
const uint16_t microsteps,
const bool stealth,
const uint32_t hyb_thrs,
const uint32_t cool_thrs,
const uint8_t cool_semin,
const uint8_t cool_semax,
const uint8_t cool_seup,
const uint8_t cool_sedn,
const bool cool_seimin
) {
st.begin(); st.begin();
CHOPCONF_t chopconf{0}; CHOPCONF_t chopconf{0};
@ -181,28 +157,13 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
UNUSED(hyb_thrs); UNUSED(hyb_thrs);
#endif #endif
st.set_cool_thrs(cool_thrs); // (mm/s)
COOLCONF_t coolconf{0};
coolconf.semin = cool_semin;
coolconf.semax = cool_semax;
coolconf.seup = cool_seup;
coolconf.sedn = cool_sedn;
coolconf.seimin = cool_seimin;
st.COOLCONF(coolconf.sr);
st.GSTAT(); // Clear GSTAT st.GSTAT(); // Clear GSTAT
} }
#endif // TMC2130 #endif // TMC2130
#if HAS_DRIVER(TMC2160) #if HAS_DRIVER(TMC2160)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID> template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
void tmc_init( 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) {
TMCMarlin<TMC2160Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st,
const uint16_t mA,
const uint16_t microsteps,
const bool stealth,
const uint32_t hyb_thrs
) {
st.begin(); st.begin();
CHOPCONF_t chopconf{0}; CHOPCONF_t chopconf{0};
@ -479,13 +440,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#if HAS_DRIVER(TMC2208) #if HAS_DRIVER(TMC2208)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID> template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
void tmc_init( 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) {
TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st,
const uint16_t mA,
const uint16_t microsteps,
const bool stealth,
const uint32_t hyb_thrs
) {
TMC2208_n::GCONF_t gconf{0}; TMC2208_n::GCONF_t gconf{0};
gconf.pdn_disable = true; // Use UART gconf.pdn_disable = true; // Use UART
gconf.mstep_reg_select = true; // Select microsteps with UART gconf.mstep_reg_select = true; // Select microsteps with UART
@ -533,19 +488,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#if HAS_DRIVER(TMC2209) #if HAS_DRIVER(TMC2209)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID> template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
void tmc_init( 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) {
TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st,
const uint16_t mA,
const uint16_t microsteps,
const bool stealth,
const uint32_t hyb_thrs,
const uint32_t cool_thrs,
const uint8_t cool_semin,
const uint8_t cool_semax,
const uint8_t cool_seup,
const uint8_t cool_sedn,
const bool cool_seimin
) {
TMC2208_n::GCONF_t gconf{0}; TMC2208_n::GCONF_t gconf{0};
gconf.pdn_disable = true; // Use UART gconf.pdn_disable = true; // Use UART
gconf.mstep_reg_select = true; // Select microsteps with UART gconf.mstep_reg_select = true; // Select microsteps with UART
@ -586,15 +529,6 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
UNUSED(hyb_thrs); UNUSED(hyb_thrs);
#endif #endif
st.set_cool_thrs(cool_thrs); // (mm/s)
COOLCONF_t coolconf{0};
coolconf.semin = cool_semin;
coolconf.semax = cool_semax;
coolconf.seup = cool_seup;
coolconf.sedn = cool_sedn;
coolconf.seimin = cool_seimin;
st.COOLCONF(coolconf.sr);
st.GSTAT(0b111); // Clear st.GSTAT(0b111); // Clear
delay(200); delay(200);
} }
@ -602,11 +536,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#if HAS_DRIVER(TMC2660) #if HAS_DRIVER(TMC2660)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID> template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
void tmc_init( 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) {
TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st,
const uint16_t mA,
const uint16_t microsteps
) {
st.begin(); st.begin();
TMC2660_n::CHOPCONF_t chopconf{0}; TMC2660_n::CHOPCONF_t chopconf{0};
@ -633,19 +563,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#if HAS_DRIVER(TMC5130) #if HAS_DRIVER(TMC5130)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID> template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
void tmc_init( 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) {
TMCMarlin<TMC5130Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st,
const uint16_t mA,
const uint16_t microsteps,
const bool stealth,
const uint32_t hyb_thrs,
const uint32_t cool_thrs,
const uint8_t cool_semin,
const uint8_t cool_semax,
const uint8_t cool_seup,
const uint8_t cool_sedn,
const bool cool_seimin
) {
st.begin(); st.begin();
CHOPCONF_t chopconf{0}; CHOPCONF_t chopconf{0};
@ -680,34 +598,13 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
UNUSED(hyb_thrs); UNUSED(hyb_thrs);
#endif #endif
st.set_cool_thrs(cool_thrs); // (mm/s)
COOLCONF_t coolconf{0};
coolconf.semin = cool_semin;
coolconf.semax = cool_semax;
coolconf.seup = cool_seup;
coolconf.sedn = cool_sedn;
coolconf.seimin = cool_seimin;
st.COOLCONF(coolconf.sr);
st.GSTAT(); // Clear GSTAT st.GSTAT(); // Clear GSTAT
} }
#endif // TMC5130 #endif // TMC5130
#if HAS_DRIVER(TMC5160) #if HAS_DRIVER(TMC5160)
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID> template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
void tmc_init( 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) {
TMCMarlin<TMC5160Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st,
const uint16_t mA,
const uint16_t microsteps,
const bool stealth,
const uint32_t hyb_thrs,
const uint32_t cool_thrs,
const uint8_t cool_semin,
const uint8_t cool_semax,
const uint8_t cool_seup,
const uint8_t cool_sedn,
const bool cool_seimin
) {
st.begin(); st.begin();
CHOPCONF_t chopconf{0}; CHOPCONF_t chopconf{0};
@ -744,16 +641,6 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#else #else
UNUSED(hyb_thrs); UNUSED(hyb_thrs);
#endif #endif
st.set_cool_thrs(cool_thrs); // (mm/s)
COOLCONF_t coolconf{0};
coolconf.semin = cool_semin;
coolconf.semax = cool_semax;
coolconf.seup = cool_seup;
coolconf.sedn = cool_sedn;
coolconf.seimin = cool_seimin;
st.COOLCONF(coolconf.sr);
st.GSTAT(); // Clear GSTAT st.GSTAT(); // Clear GSTAT
} }
#endif // TMC5160 #endif // TMC5160

Loading…
Cancel
Save