Selaa lähdekoodia

Simplify TMC monitor code

Scott Lahteine 5 vuotta sitten
vanhempi
commit
f6a6839a82
1 muutettua tiedostoa jossa 47 lisäystä ja 38 poistoa
  1. 47
    38
      Marlin/src/feature/tmc_util.cpp

+ 47
- 38
Marlin/src/feature/tmc_util.cpp Näytä tiedosto

346
     #endif
346
     #endif
347
 
347
 
348
     if (need_update_error_counters || need_debug_reporting) {
348
     if (need_update_error_counters || need_debug_reporting) {
349
-      #if AXIS_IS_TMC(X)
349
+
350
-        if (monitor_tmc_driver(stepperX, need_update_error_counters, need_debug_reporting)) {
350
+      #if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2)
351
-          #if AXIS_IS_TMC(X2)
351
+      {
352
-            step_current_down(stepperX2);
352
+        bool result = false;
353
-          #endif
353
+        #if AXIS_IS_TMC(X)
354
-        }
354
+          if (monitor_tmc_driver(stepperX, need_update_error_counters, need_debug_reporting)) result = true;
355
-      #endif
355
+        #endif
356
-      #if AXIS_IS_TMC(X2)
356
+        #if AXIS_IS_TMC(X2)
357
-        if (monitor_tmc_driver(stepperX2, need_update_error_counters, need_debug_reporting)) {
357
+          if (monitor_tmc_driver(stepperX2, need_update_error_counters, need_debug_reporting)) result = true;
358
+        #endif
359
+        if (result) {
358
           #if AXIS_IS_TMC(X)
360
           #if AXIS_IS_TMC(X)
359
             step_current_down(stepperX);
361
             step_current_down(stepperX);
360
           #endif
362
           #endif
361
-        }
363
+          #if AXIS_IS_TMC(X2)
362
-      #endif
364
+            step_current_down(stepperX2);
363
-      #if AXIS_IS_TMC(Y)
364
-        if (monitor_tmc_driver(stepperY, need_update_error_counters, need_debug_reporting)) {
365
-          #if AXIS_IS_TMC(Y2)
366
-            step_current_down(stepperY2);
367
           #endif
365
           #endif
368
         }
366
         }
367
+      }
369
       #endif
368
       #endif
370
-      #if AXIS_IS_TMC(Y2)
369
+
371
-        if (monitor_tmc_driver(stepperY2, need_update_error_counters, need_debug_reporting)) {
370
+      #if AXIS_IS_TMC(Y) || AXIS_IS_TMC(Y2)
371
+      {
372
+        bool result = false;
373
+        #if AXIS_IS_TMC(Y)
374
+          if (monitor_tmc_driver(stepperY, need_update_error_counters, need_debug_reporting)) result = true;
375
+        #endif
376
+        #if AXIS_IS_TMC(Y2)
377
+          if (monitor_tmc_driver(stepperY2, need_update_error_counters, need_debug_reporting)) result = true;
378
+        #endif
379
+        if (result) {
372
           #if AXIS_IS_TMC(Y)
380
           #if AXIS_IS_TMC(Y)
373
             step_current_down(stepperY);
381
             step_current_down(stepperY);
374
           #endif
382
           #endif
375
-        }
383
+          #if AXIS_IS_TMC(Y2)
376
-      #endif
384
+            step_current_down(stepperY2);
377
-      #if AXIS_IS_TMC(Z)
378
-        if (monitor_tmc_driver(stepperZ, need_update_error_counters, need_debug_reporting)) {
379
-          #if AXIS_IS_TMC(Z2)
380
-            step_current_down(stepperZ2);
381
-          #endif
382
-          #if AXIS_IS_TMC(Z3)
383
-            step_current_down(stepperZ3);
384
-          #endif
385
-        }
386
-      #endif
387
-      #if AXIS_IS_TMC(Z2)
388
-        if (monitor_tmc_driver(stepperZ2, need_update_error_counters, need_debug_reporting)) {
389
-          #if AXIS_IS_TMC(Z)
390
-            step_current_down(stepperZ);
391
-          #endif
392
-          #if AXIS_IS_TMC(Z3)
393
-            step_current_down(stepperZ3);
394
           #endif
385
           #endif
395
         }
386
         }
387
+      }
396
       #endif
388
       #endif
397
-      #if AXIS_IS_TMC(Z3)
389
+
398
-        if (monitor_tmc_driver(stepperZ3, need_update_error_counters, need_debug_reporting)) {
390
+      #if AXIS_IS_TMC(Z) || AXIS_IS_TMC(Z2) || AXIS_IS_TMC(Z3)
391
+      {
392
+        bool result = false;
393
+        #if AXIS_IS_TMC(Z)
394
+          if (monitor_tmc_driver(stepperZ, need_update_error_counters, need_debug_reporting)) result = true;
395
+        #endif
396
+        #if AXIS_IS_TMC(Z2)
397
+          if (monitor_tmc_driver(stepperZ2, need_update_error_counters, need_debug_reporting)) result = true;
398
+        #endif
399
+        #if AXIS_IS_TMC(Z3)
400
+          if (monitor_tmc_driver(stepperZ3, need_update_error_counters, need_debug_reporting)) result = true;
401
+        #endif
402
+        if (result) {
399
           #if AXIS_IS_TMC(Z)
403
           #if AXIS_IS_TMC(Z)
400
             step_current_down(stepperZ);
404
             step_current_down(stepperZ);
401
           #endif
405
           #endif
402
           #if AXIS_IS_TMC(Z2)
406
           #if AXIS_IS_TMC(Z2)
403
             step_current_down(stepperZ2);
407
             step_current_down(stepperZ2);
404
           #endif
408
           #endif
409
+          #if AXIS_IS_TMC(Z3)
410
+            step_current_down(stepperZ3);
411
+          #endif
405
         }
412
         }
413
+      }
406
       #endif
414
       #endif
415
+
407
       #if AXIS_IS_TMC(E0)
416
       #if AXIS_IS_TMC(E0)
408
         (void)monitor_tmc_driver(stepperE0, need_update_error_counters, need_debug_reporting);
417
         (void)monitor_tmc_driver(stepperE0, need_update_error_counters, need_debug_reporting);
409
       #endif
418
       #endif

Loading…
Peruuta
Tallenna