Add missing dedge init for TMC2209 (#14370)
This commit is contained in:
parent
1db7013e3b
commit
2247bf1ba5
@ -269,14 +269,12 @@
|
||||
void tmc_init(TMCMarlin<TMC2160Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const bool stealth) {
|
||||
st.begin();
|
||||
|
||||
static constexpr int8_t timings[] = CHOPPER_TIMING; // Default 4, -2, 1
|
||||
|
||||
CHOPCONF_t chopconf{0};
|
||||
chopconf.tbl = 1;
|
||||
chopconf.toff = timings[0];
|
||||
chopconf.toff = chopper_timing.toff;
|
||||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = timings[1] + 3;
|
||||
chopconf.hstrt = timings[2] - 1;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
@ -286,16 +284,9 @@
|
||||
st.microsteps(microsteps);
|
||||
st.iholddelay(10);
|
||||
st.TPOWERDOWN(128); // ~2s until driver lowers to hold current
|
||||
st.TCOOLTHRS(0xFFFFF);
|
||||
|
||||
#if ENABLED(ADAPTIVE_CURRENT)
|
||||
COOLCONF_t coolconf{0};
|
||||
coolconf.semin = INCREASE_CURRENT_THRS;
|
||||
coolconf.semax = REDUCE_CURRENT_THRS;
|
||||
st.COOLCONF(coolconf.sr);
|
||||
#endif
|
||||
|
||||
st.en_pwm_mode(stealth);
|
||||
st.stored.stealthChop_enabled = stealth;
|
||||
|
||||
TMC2160_n::PWMCONF_t pwmconf{0};
|
||||
pwmconf.pwm_lim = 12;
|
||||
@ -573,6 +564,9 @@
|
||||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
st.CHOPCONF(chopconf.sr);
|
||||
|
||||
st.rms_current(mA, HOLD_MULTIPLIER);
|
||||
@ -673,14 +667,12 @@
|
||||
void tmc_init(TMCMarlin<TMC5160Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const bool stealth) {
|
||||
st.begin();
|
||||
|
||||
int8_t timings[] = CHOPPER_TIMING; // Default 4, -2, 1
|
||||
|
||||
CHOPCONF_t chopconf{0};
|
||||
chopconf.tbl = 1;
|
||||
chopconf.toff = timings[0];
|
||||
chopconf.toff = chopper_timing.toff;
|
||||
chopconf.intpol = INTERPOLATE;
|
||||
chopconf.hend = timings[1] + 3;
|
||||
chopconf.hstrt = timings[2] - 1;
|
||||
chopconf.hend = chopper_timing.hend + 3;
|
||||
chopconf.hstrt = chopper_timing.hstrt - 1;
|
||||
#if ENABLED(SQUARE_WAVE_STEPPING)
|
||||
chopconf.dedge = true;
|
||||
#endif
|
||||
@ -691,14 +683,8 @@
|
||||
st.iholddelay(10);
|
||||
st.TPOWERDOWN(128); // ~2s until driver lowers to hold current
|
||||
|
||||
#if ENABLED(ADAPTIVE_CURRENT)
|
||||
COOLCONF_t coolconf{0};
|
||||
coolconf.semin = INCREASE_CURRENT_THRS;
|
||||
coolconf.semax = REDUCE_CURRENT_THRS;
|
||||
st.COOLCONF(coolconf.sr);
|
||||
#endif
|
||||
|
||||
st.en_pwm_mode(stealth);
|
||||
st.stored.stealthChop_enabled = stealth;
|
||||
|
||||
TMC2160_n::PWMCONF_t pwmconf{0};
|
||||
pwmconf.pwm_lim = 12;
|
||||
|
Loading…
Reference in New Issue
Block a user