Procházet zdrojové kódy

Unify M91x parameter I meaning, simplify reports (#11249)

Scott Lahteine před 7 roky
rodič
revize
fd8a76493b
No account linked to committer's email address

+ 34
- 42
Marlin/src/gcode/feature/trinamic/M906.cpp Zobrazit soubor

88
     }
88
     }
89
   }
89
   }
90
 
90
 
91
-  if (report) LOOP_XYZE(i) switch (i) {
92
-    case X_AXIS:
93
-      #if X_IS_TRINAMIC
94
-        TMC_SAY_CURRENT(X);
95
-      #endif
96
-      #if X2_IS_TRINAMIC
97
-        TMC_SAY_CURRENT(X2);
98
-      #endif
99
-      break;
100
-    case Y_AXIS:
101
-      #if Y_IS_TRINAMIC
102
-        TMC_SAY_CURRENT(Y);
103
-      #endif
104
-      #if Y2_IS_TRINAMIC
105
-        TMC_SAY_CURRENT(Y2);
106
-      #endif
107
-      break;
108
-    case Z_AXIS:
109
-      #if Z_IS_TRINAMIC
110
-        TMC_SAY_CURRENT(Z);
111
-      #endif
112
-      #if Z2_IS_TRINAMIC
113
-        TMC_SAY_CURRENT(Z2);
114
-      #endif
115
-      break;
116
-    case E_AXIS:
117
-      #if E0_IS_TRINAMIC
118
-        TMC_SAY_CURRENT(E0);
119
-      #endif
120
-      #if E1_IS_TRINAMIC
121
-        TMC_SAY_CURRENT(E1);
122
-      #endif
123
-      #if E2_IS_TRINAMIC
124
-        TMC_SAY_CURRENT(E2);
125
-      #endif
126
-      #if E3_IS_TRINAMIC
127
-        TMC_SAY_CURRENT(E3);
128
-      #endif
129
-      #if E4_IS_TRINAMIC
130
-        TMC_SAY_CURRENT(E4);
131
-      #endif
132
-      break;
91
+  if (report) {
92
+    #if X_IS_TRINAMIC
93
+      TMC_SAY_CURRENT(X);
94
+    #endif
95
+    #if X2_IS_TRINAMIC
96
+      TMC_SAY_CURRENT(X2);
97
+    #endif
98
+    #if Y_IS_TRINAMIC
99
+      TMC_SAY_CURRENT(Y);
100
+    #endif
101
+    #if Y2_IS_TRINAMIC
102
+      TMC_SAY_CURRENT(Y2);
103
+    #endif
104
+    #if Z_IS_TRINAMIC
105
+      TMC_SAY_CURRENT(Z);
106
+    #endif
107
+    #if Z2_IS_TRINAMIC
108
+      TMC_SAY_CURRENT(Z2);
109
+    #endif
110
+    #if E0_IS_TRINAMIC
111
+      TMC_SAY_CURRENT(E0);
112
+    #endif
113
+    #if E1_IS_TRINAMIC
114
+      TMC_SAY_CURRENT(E1);
115
+    #endif
116
+    #if E2_IS_TRINAMIC
117
+      TMC_SAY_CURRENT(E2);
118
+    #endif
119
+    #if E3_IS_TRINAMIC
120
+      TMC_SAY_CURRENT(E3);
121
+    #endif
122
+    #if E4_IS_TRINAMIC
123
+      TMC_SAY_CURRENT(E4);
124
+    #endif
133
   }
125
   }
134
 }
126
 }
135
 
127
 

+ 59
- 73
Marlin/src/gcode/feature/trinamic/M911-M915.cpp Zobrazit soubor

208
       }
208
       }
209
     }
209
     }
210
 
210
 
211
-    if (report) LOOP_XYZE(i) switch (i) {
212
-      case X_AXIS:
213
-        #if X_IS_TRINAMIC
214
-          TMC_SAY_PWMTHRS(X,X);
215
-        #endif
216
-        #if X2_IS_TRINAMIC
217
-          TMC_SAY_PWMTHRS(X,X2);
218
-        #endif
219
-        break;
220
-      case Y_AXIS:
221
-        #if Y_IS_TRINAMIC
222
-          TMC_SAY_PWMTHRS(Y,Y);
223
-        #endif
224
-        #if Y2_IS_TRINAMIC
225
-          TMC_SAY_PWMTHRS(Y,Y2);
226
-        #endif
227
-        break;
228
-      case Z_AXIS:
229
-        #if Z_IS_TRINAMIC
230
-          TMC_SAY_PWMTHRS(Z,Z);
231
-        #endif
232
-        #if Z2_IS_TRINAMIC
233
-          TMC_SAY_PWMTHRS(Z,Z2);
234
-        #endif
235
-        break;
236
-      case E_AXIS:
237
-        #if E0_IS_TRINAMIC
238
-          TMC_SAY_PWMTHRS_E(0);
239
-        #endif
240
-        #if E_STEPPERS > 1 && E1_IS_TRINAMIC
241
-          TMC_SAY_PWMTHRS_E(1);
242
-        #endif
243
-        #if E_STEPPERS > 2 && E2_IS_TRINAMIC
244
-          TMC_SAY_PWMTHRS_E(2);
245
-        #endif
246
-        #if E_STEPPERS > 3 && E3_IS_TRINAMIC
247
-          TMC_SAY_PWMTHRS_E(3);
248
-        #endif
249
-        #if E_STEPPERS > 4 && E4_IS_TRINAMIC
250
-          TMC_SAY_PWMTHRS_E(4);
251
-        #endif
252
-        break;
211
+    if (report) {
212
+      #if X_IS_TRINAMIC
213
+        TMC_SAY_PWMTHRS(X,X);
214
+      #endif
215
+      #if X2_IS_TRINAMIC
216
+        TMC_SAY_PWMTHRS(X,X2);
217
+      #endif
218
+      #if Y_IS_TRINAMIC
219
+        TMC_SAY_PWMTHRS(Y,Y);
220
+      #endif
221
+      #if Y2_IS_TRINAMIC
222
+        TMC_SAY_PWMTHRS(Y,Y2);
223
+      #endif
224
+      #if Z_IS_TRINAMIC
225
+        TMC_SAY_PWMTHRS(Z,Z);
226
+      #endif
227
+      #if Z2_IS_TRINAMIC
228
+        TMC_SAY_PWMTHRS(Z,Z2);
229
+      #endif
230
+      #if E0_IS_TRINAMIC
231
+        TMC_SAY_PWMTHRS_E(0);
232
+      #endif
233
+      #if E_STEPPERS > 1 && E1_IS_TRINAMIC
234
+        TMC_SAY_PWMTHRS_E(1);
235
+      #endif
236
+      #if E_STEPPERS > 2 && E2_IS_TRINAMIC
237
+        TMC_SAY_PWMTHRS_E(2);
238
+      #endif
239
+      #if E_STEPPERS > 3 && E3_IS_TRINAMIC
240
+        TMC_SAY_PWMTHRS_E(3);
241
+      #endif
242
+      #if E_STEPPERS > 4 && E4_IS_TRINAMIC
243
+        TMC_SAY_PWMTHRS_E(4);
244
+      #endif
253
     }
245
     }
254
   }
246
   }
255
 #endif // HYBRID_THRESHOLD
247
 #endif // HYBRID_THRESHOLD
271
         #if X_SENSORLESS
263
         #if X_SENSORLESS
272
           case X_AXIS:
264
           case X_AXIS:
273
             #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
265
             #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
274
-              if (index == 0) TMC_SET_SGT(X);
266
+              if (index < 2) TMC_SET_SGT(X);
275
             #endif
267
             #endif
276
             #if ENABLED(X2_IS_TMC2130)
268
             #if ENABLED(X2_IS_TMC2130)
277
-              if (index == 1) TMC_SET_SGT(X2);
269
+              if (!(index & 1)) TMC_SET_SGT(X2);
278
             #endif
270
             #endif
279
             break;
271
             break;
280
         #endif
272
         #endif
281
         #if Y_SENSORLESS
273
         #if Y_SENSORLESS
282
           case Y_AXIS:
274
           case Y_AXIS:
283
             #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
275
             #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
284
-              if (index == 0) TMC_SET_SGT(Y);
276
+              if (index < 2) TMC_SET_SGT(Y);
285
             #endif
277
             #endif
286
             #if ENABLED(Y2_IS_TMC2130)
278
             #if ENABLED(Y2_IS_TMC2130)
287
-              if (index == 1) TMC_SET_SGT(Y2);
279
+              if (!(index & 1)) TMC_SET_SGT(Y2);
288
             #endif
280
             #endif
289
             break;
281
             break;
290
         #endif
282
         #endif
291
         #if Z_SENSORLESS
283
         #if Z_SENSORLESS
292
           case Z_AXIS:
284
           case Z_AXIS:
293
             #if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
285
             #if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
294
-              if (index == 0) TMC_SET_SGT(Z);
286
+              if (index < 2) TMC_SET_SGT(Z);
295
             #endif
287
             #endif
296
             #if ENABLED(Z2_IS_TMC2130)
288
             #if ENABLED(Z2_IS_TMC2130)
297
-              if (index == 1) TMC_SET_SGT(Z2);
289
+              if (!(index & 1)) TMC_SET_SGT(Z2);
298
             #endif
290
             #endif
299
             break;
291
             break;
300
         #endif
292
         #endif
301
       }
293
       }
302
     }
294
     }
303
 
295
 
304
-    if (report) LOOP_XYZ(i) switch (i) {
296
+    if (report) {
305
       #if X_SENSORLESS
297
       #if X_SENSORLESS
306
-        case X_AXIS:
307
-          #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
308
-            TMC_SAY_SGT(X);
309
-          #endif
310
-          #if ENABLED(X2_IS_TMC2130)
311
-            TMC_SAY_SGT(X2);
312
-          #endif
313
-          break;
298
+        #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
299
+          TMC_SAY_SGT(X);
300
+        #endif
301
+        #if ENABLED(X2_IS_TMC2130)
302
+          TMC_SAY_SGT(X2);
303
+        #endif
314
       #endif
304
       #endif
315
       #if Y_SENSORLESS
305
       #if Y_SENSORLESS
316
-        case Y_AXIS:
317
-          #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
318
-            TMC_SAY_SGT(Y);
319
-          #endif
320
-          #if ENABLED(Y2_IS_TMC2130)
321
-            TMC_SAY_SGT(Y2);
322
-          #endif
323
-          break;
306
+        #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
307
+          TMC_SAY_SGT(Y);
308
+        #endif
309
+        #if ENABLED(Y2_IS_TMC2130)
310
+          TMC_SAY_SGT(Y2);
311
+        #endif
324
       #endif
312
       #endif
325
       #if Z_SENSORLESS
313
       #if Z_SENSORLESS
326
-        case Z_AXIS:
327
-          #if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
328
-            TMC_SAY_SGT(Z);
329
-          #endif
330
-          #if ENABLED(Z2_IS_TMC2130)
331
-            TMC_SAY_SGT(Z2);
332
-          #endif
333
-          break;
314
+        #if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
315
+          TMC_SAY_SGT(Z);
316
+        #endif
317
+        #if ENABLED(Z2_IS_TMC2130)
318
+          TMC_SAY_SGT(Z2);
319
+        #endif
334
       #endif
320
       #endif
335
     }
321
     }
336
   }
322
   }

Loading…
Zrušit
Uložit