Browse Source

Fix TMC_DEBUG undefined report_tmc_status (#11993)

Scott Lahteine 6 years ago
parent
commit
8daadd2c8c
No account linked to committer's email address
1 changed files with 19 additions and 15 deletions
  1. 19
    15
      Marlin/src/feature/tmc_util.cpp

+ 19
- 15
Marlin/src/feature/tmc_util.cpp View File

@@ -34,6 +34,7 @@
34 34
 
35 35
 #if ENABLED(TMC_DEBUG)
36 36
   #include "../module/planner.h"
37
+  static bool report_tmc_status; // = false;
37 38
 #endif
38 39
 
39 40
 /**
@@ -44,7 +45,6 @@
44 45
  * and so we don't repeatedly report warning before the condition is cleared.
45 46
  */
46 47
 #if ENABLED(MONITOR_DRIVER_STATUS)
47
-  static bool report_tmc_status = false;
48 48
 
49 49
   struct TMC_driver_data {
50 50
     uint32_t drv_status;
@@ -144,19 +144,21 @@
144 144
     }
145 145
     else if (st.otpw_count > 0) st.otpw_count = 0;
146 146
 
147
-    if (report_tmc_status) {
148
-      const uint32_t pwm_scale = get_pwm_scale(st);
149
-      st.printLabel();
150
-      SERIAL_ECHOPAIR(":", pwm_scale);
151
-      SERIAL_ECHOPGM(" |0b"); SERIAL_PRINT(get_status_response(st), BIN);
152
-      SERIAL_ECHOPGM("| ");
153
-      if (data.is_error) SERIAL_CHAR('E');
154
-      else if (data.is_ot) SERIAL_CHAR('O');
155
-      else if (data.is_otpw) SERIAL_CHAR('W');
156
-      else if (st.otpw_count > 0) SERIAL_PRINT(st.otpw_count, DEC);
157
-      else if (st.flag_otpw) SERIAL_CHAR('F');
158
-      SERIAL_CHAR('\t');
159
-    }
147
+    #if ENABLED(TMC_DEBUG)
148
+      if (report_tmc_status) {
149
+        const uint32_t pwm_scale = get_pwm_scale(st);
150
+        st.printLabel();
151
+        SERIAL_ECHOPAIR(":", pwm_scale);
152
+        SERIAL_ECHOPGM(" |0b"); SERIAL_PRINT(get_status_response(st), BIN);
153
+        SERIAL_ECHOPGM("| ");
154
+        if (data.is_error) SERIAL_CHAR('E');
155
+        else if (data.is_ot) SERIAL_CHAR('O');
156
+        else if (data.is_otpw) SERIAL_CHAR('W');
157
+        else if (st.otpw_count > 0) SERIAL_PRINT(st.otpw_count, DEC);
158
+        else if (st.flag_otpw) SERIAL_CHAR('F');
159
+        SERIAL_CHAR('\t');
160
+      }
161
+    #endif
160 162
   }
161 163
 
162 164
   #define HAS_HW_COMMS(ST) AXIS_DRIVER_TYPE(ST, TMC2130) || (AXIS_DRIVER_TYPE(ST, TMC2208) && defined(ST##_HARDWARE_SERIAL))
@@ -205,7 +207,9 @@
205 207
         monitor_tmc_driver(stepperE5);
206 208
       #endif
207 209
 
208
-      if (report_tmc_status) SERIAL_EOL();
210
+      #if ENABLED(TMC_DEBUG)
211
+        if (report_tmc_status) SERIAL_EOL();
212
+      #endif
209 213
     }
210 214
   }
211 215
 

Loading…
Cancel
Save