Fix TMC220x short circuit (#20731)

This commit is contained in:
devin122 2021-01-11 02:46:17 -05:00 committed by Scott Lahteine
parent 92f847c8f7
commit 8eb32cef24

View file

@ -147,7 +147,7 @@
static TMC_driver_data get_driver_data(TMC2208Stepper &st) { static TMC_driver_data get_driver_data(TMC2208Stepper &st) {
constexpr uint8_t OTPW_bp = 0, OT_bp = 1; constexpr uint8_t OTPW_bp = 0, OT_bp = 1;
constexpr uint8_t S2G_bm = 0b11110; // 2..5 constexpr uint8_t S2G_bm = 0b111100; // 2..5
TMC_driver_data data; TMC_driver_data data;
const auto ds = data.drv_status = st.DRV_STATUS(); const auto ds = data.drv_status = st.DRV_STATUS();
data.is_otpw = TEST(ds, OTPW_bp); data.is_otpw = TEST(ds, OTPW_bp);
@ -291,7 +291,7 @@
bool should_step_down = false; bool should_step_down = false;
if (need_update_error_counters) { if (need_update_error_counters) {
if (data.is_ot /* | data.s2ga | data.s2gb*/) st.error_count++; if (data.is_ot | data.is_s2g) st.error_count++;
else if (st.error_count > 0) st.error_count--; else if (st.error_count > 0) st.error_count--;
#if ENABLED(STOP_ON_ERROR) #if ENABLED(STOP_ON_ERROR)