[2.0.x] TMC: Fix CURRENT_STEP_DOWN (#10170)

This commit is contained in:
teemuatlut 2018-03-20 22:16:05 +02:00 committed by Scott Lahteine
parent a5c6d3c7b8
commit b5b39af531

View file

@ -128,8 +128,8 @@ bool report_tmc_status = false;
SERIAL_ECHOLNPGM("mA)"); SERIAL_ECHOLNPGM("mA)");
} }
#if CURRENT_STEP_DOWN > 0 #if CURRENT_STEP_DOWN > 0
// Decrease current if is_otpw is true and driver is enabled and there's been more then 4 warnings // 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) { if (data.is_otpw && st.isEnabled() && otpw_cnt > 4) {
st.setCurrent(st.getCurrent() - CURRENT_STEP_DOWN, R_SENSE, HOLD_MULTIPLIER); st.setCurrent(st.getCurrent() - CURRENT_STEP_DOWN, R_SENSE, HOLD_MULTIPLIER);
#if ENABLED(REPORT_CURRENT_CHANGE) #if ENABLED(REPORT_CURRENT_CHANGE)
_tmc_say_axis(axis); _tmc_say_axis(axis);
@ -142,7 +142,7 @@ bool report_tmc_status = false;
otpw_cnt++; otpw_cnt++;
st.flag_otpw = true; st.flag_otpw = true;
} }
else if (otpw_cnt > 0) otpw_cnt--; else if (otpw_cnt > 0) otpw_cnt = 0;
if (report_tmc_status) { if (report_tmc_status) {
const uint32_t pwm_scale = get_pwm_scale(st); const uint32_t pwm_scale = get_pwm_scale(st);