Browse Source

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

teemuatlut 7 years ago
parent
commit
b5b39af531
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      Marlin/src/feature/tmc_util.cpp

+ 3
- 3
Marlin/src/feature/tmc_util.cpp View File

@@ -128,8 +128,8 @@ bool report_tmc_status = false;
128 128
       SERIAL_ECHOLNPGM("mA)");
129 129
     }
130 130
     #if CURRENT_STEP_DOWN > 0
131
-      // Decrease current if is_otpw is true and driver is enabled and there's been more then 4 warnings
132
-      if (data.is_otpw && !st.isEnabled() && otpw_cnt > 4) {
131
+      // Decrease current if is_otpw is true and driver is enabled and there's been more than 4 warnings
132
+      if (data.is_otpw && st.isEnabled() && otpw_cnt > 4) {
133 133
         st.setCurrent(st.getCurrent() - CURRENT_STEP_DOWN, R_SENSE, HOLD_MULTIPLIER);
134 134
         #if ENABLED(REPORT_CURRENT_CHANGE)
135 135
           _tmc_say_axis(axis);
@@ -142,7 +142,7 @@ bool report_tmc_status = false;
142 142
       otpw_cnt++;
143 143
       st.flag_otpw = true;
144 144
     }
145
-    else if (otpw_cnt > 0) otpw_cnt--;
145
+    else if (otpw_cnt > 0) otpw_cnt = 0;
146 146
 
147 147
     if (report_tmc_status) {
148 148
       const uint32_t pwm_scale = get_pwm_scale(st);

Loading…
Cancel
Save