|
@@ -1022,7 +1022,7 @@
|
1022
|
1022
|
#if USE_SENSORLESS
|
1023
|
1023
|
|
1024
|
1024
|
bool tmc_enable_stallguard(TMC2130Stepper &st) {
|
1025
|
|
- bool stealthchop_was_enabled = st.en_pwm_mode();
|
|
1025
|
+ const bool stealthchop_was_enabled = st.en_pwm_mode();
|
1026
|
1026
|
|
1027
|
1027
|
st.TCOOLTHRS(0xFFFFF);
|
1028
|
1028
|
st.en_pwm_mode(false);
|
|
@@ -1038,7 +1038,7 @@
|
1038
|
1038
|
|
1039
|
1039
|
bool tmc_enable_stallguard(TMC2209Stepper &st) {
|
1040
|
1040
|
st.TCOOLTHRS(0xFFFFF);
|
1041
|
|
- return stealthchop_was_enabled;
|
|
1041
|
+ return !st.en_spreadCycle();
|
1042
|
1042
|
}
|
1043
|
1043
|
void tmc_disable_stallguard(TMC2209Stepper &st, const bool restore_stealth) {
|
1044
|
1044
|
st.en_spreadCycle(!restore_stealth);
|