Browse Source

No M914 or SGT set for non-sensorless axes

Scott Lahteine 7 years ago
parent
commit
9c058091e9

+ 46
- 34
Marlin/src/gcode/feature/trinamic/M911-M915.cpp View File

@@ -268,58 +268,70 @@ void GcodeSuite::M912() {
268 268
       const int8_t value = (int8_t)constrain(parser.value_int(), -64, 63);
269 269
       report = false;
270 270
       switch (i) {
271
+        #if X_SENSORLESS
272
+          case X_AXIS:
273
+            #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
274
+              if (index == 0) TMC_SET_SGT(X);
275
+            #endif
276
+            #if ENABLED(X2_IS_TMC2130)
277
+              if (index == 1) TMC_SET_SGT(X2);
278
+            #endif
279
+            break;
280
+        #endif
281
+        #if Y_SENSORLESS
282
+          case Y_AXIS:
283
+            #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
284
+              if (index == 0) TMC_SET_SGT(Y);
285
+            #endif
286
+            #if ENABLED(Y2_IS_TMC2130)
287
+              if (index == 1) TMC_SET_SGT(Y2);
288
+            #endif
289
+            break;
290
+        #endif
291
+        #if Z_SENSORLESS
292
+          case Z_AXIS:
293
+            #if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
294
+              if (index == 0) TMC_SET_SGT(Z);
295
+            #endif
296
+            #if ENABLED(Z2_IS_TMC2130)
297
+              if (index == 1) TMC_SET_SGT(Z2);
298
+            #endif
299
+            break;
300
+        #endif
301
+      }
302
+    }
303
+
304
+    if (report) LOOP_XYZ(i) switch (i) {
305
+      #if X_SENSORLESS
271 306
         case X_AXIS:
272 307
           #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
273
-            if (index == 0) TMC_SET_SGT(X);
308
+            TMC_SAY_SGT(X);
274 309
           #endif
275 310
           #if ENABLED(X2_IS_TMC2130)
276
-            if (index == 1) TMC_SET_SGT(X2);
311
+            TMC_SAY_SGT(X2);
277 312
           #endif
278 313
           break;
314
+      #endif
315
+      #if Y_SENSORLESS
279 316
         case Y_AXIS:
280 317
           #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
281
-            if (index == 0) TMC_SET_SGT(Y);
318
+            TMC_SAY_SGT(Y);
282 319
           #endif
283 320
           #if ENABLED(Y2_IS_TMC2130)
284
-            if (index == 1) TMC_SET_SGT(Y2);
321
+            TMC_SAY_SGT(Y2);
285 322
           #endif
286 323
           break;
324
+      #endif
325
+      #if Z_SENSORLESS
287 326
         case Z_AXIS:
288 327
           #if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
289
-            if (index == 0) TMC_SET_SGT(Z);
328
+            TMC_SAY_SGT(Z);
290 329
           #endif
291 330
           #if ENABLED(Z2_IS_TMC2130)
292
-            if (index == 1) TMC_SET_SGT(Z2);
331
+            TMC_SAY_SGT(Z2);
293 332
           #endif
294 333
           break;
295
-      }
296
-    }
297
-
298
-    if (report) LOOP_XYZ(i) switch (i) {
299
-      case X_AXIS:
300
-        #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
301
-          TMC_SAY_SGT(X);
302
-        #endif
303
-        #if ENABLED(X2_IS_TMC2130)
304
-          TMC_SAY_SGT(X2);
305
-        #endif
306
-        break;
307
-      case Y_AXIS:
308
-        #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
309
-          TMC_SAY_SGT(Y);
310
-        #endif
311
-        #if ENABLED(Y2_IS_TMC2130)
312
-          TMC_SAY_SGT(Y2);
313
-        #endif
314
-        break;
315
-      case Z_AXIS:
316
-        #if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
317
-          TMC_SAY_SGT(Z);
318
-        #endif
319
-        #if ENABLED(Z2_IS_TMC2130)
320
-          TMC_SAY_SGT(Z2);
321
-        #endif
322
-        break;
334
+      #endif
323 335
     }
324 336
   }
325 337
 #endif // SENSORLESS_HOMING

+ 3
- 3
Marlin/src/module/stepper_indirection.cpp View File

@@ -249,7 +249,7 @@
249 249
 
250 250
     #if ENABLED(SENSORLESS_HOMING)
251 251
       #define TMC_INIT_SGT(P,Q) stepper##Q.sgt(P##_HOMING_SENSITIVITY);
252
-      #ifdef X_HOMING_SENSITIVITY
252
+      #if X_SENSORLESS
253 253
         #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
254 254
           stepperX.sgt(X_HOMING_SENSITIVITY);
255 255
         #endif
@@ -257,7 +257,7 @@
257 257
           stepperX2.sgt(X_HOMING_SENSITIVITY);
258 258
         #endif
259 259
       #endif
260
-      #ifdef Y_HOMING_SENSITIVITY
260
+      #if Y_SENSORLESS
261 261
         #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
262 262
           stepperY.sgt(Y_HOMING_SENSITIVITY);
263 263
         #endif
@@ -265,7 +265,7 @@
265 265
           stepperY2.sgt(Y_HOMING_SENSITIVITY);
266 266
         #endif
267 267
       #endif
268
-      #ifdef Z_HOMING_SENSITIVITY
268
+      #if Z_SENSORLESS
269 269
         #if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
270 270
           stepperZ.sgt(Z_HOMING_SENSITIVITY);
271 271
         #endif

Loading…
Cancel
Save