|
@ -1022,7 +1022,7 @@ |
|
|
#if USE_SENSORLESS |
|
|
#if USE_SENSORLESS |
|
|
|
|
|
|
|
|
bool tmc_enable_stallguard(TMC2130Stepper &st) { |
|
|
bool tmc_enable_stallguard(TMC2130Stepper &st) { |
|
|
bool stealthchop_was_enabled = st.en_pwm_mode(); |
|
|
const bool stealthchop_was_enabled = st.en_pwm_mode(); |
|
|
|
|
|
|
|
|
st.TCOOLTHRS(0xFFFFF); |
|
|
st.TCOOLTHRS(0xFFFFF); |
|
|
st.en_pwm_mode(false); |
|
|
st.en_pwm_mode(false); |
|
@ -1038,7 +1038,7 @@ |
|
|
|
|
|
|
|
|
bool tmc_enable_stallguard(TMC2209Stepper &st) { |
|
|
bool tmc_enable_stallguard(TMC2209Stepper &st) { |
|
|
st.TCOOLTHRS(0xFFFFF); |
|
|
st.TCOOLTHRS(0xFFFFF); |
|
|
return stealthchop_was_enabled; |
|
|
return !st.en_spreadCycle(); |
|
|
} |
|
|
} |
|
|
void tmc_disable_stallguard(TMC2209Stepper &st, const bool restore_stealth) { |
|
|
void tmc_disable_stallguard(TMC2209Stepper &st, const bool restore_stealth) { |
|
|
st.en_spreadCycle(!restore_stealth); |
|
|
st.en_spreadCycle(!restore_stealth); |
|
|