From 8e783e24e83f17790cd3b6f2242259509c1b4a2f Mon Sep 17 00:00:00 2001 From: teemuatlut Date: Tue, 20 Mar 2018 22:15:15 +0200 Subject: [PATCH] [1.1.x] TMC: Fix CURRENT_STEP_DOWN (#10169) --- Marlin/tmc_util.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/tmc_util.cpp b/Marlin/tmc_util.cpp index e2d60bf7a..b154c3ea5 100644 --- a/Marlin/tmc_util.cpp +++ b/Marlin/tmc_util.cpp @@ -126,8 +126,8 @@ bool report_tmc_status = false; SERIAL_ECHOLNPGM("mA)"); } #if CURRENT_STEP_DOWN > 0 - // Decrease current if is_otpw is true and driver is enabled and there's been more then 4 warnings - if (data.is_otpw && !st.isEnabled() && otpw_cnt > 4) { + // Decrease current if is_otpw is true and driver is enabled and there's been more than 4 warnings + if (data.is_otpw && st.isEnabled() && otpw_cnt > 4) { st.setCurrent(st.getCurrent() - CURRENT_STEP_DOWN, R_SENSE, HOLD_MULTIPLIER); #if ENABLED(REPORT_CURRENT_CHANGE) _tmc_say_axis(axis); @@ -140,7 +140,7 @@ bool report_tmc_status = false; otpw_cnt++; st.flag_otpw = true; } - else if (otpw_cnt > 0) otpw_cnt--; + else if (otpw_cnt > 0) otpw_cnt = 0; if (report_tmc_status) { const uint32_t pwm_scale = get_pwm_scale(st);