Browse Source

Add CorePQ support for BABYSTEPPING (#10155)

Scott Lahteine 7 years ago
parent
commit
eaefc1e410
No account linked to committer's email address
1 changed files with 37 additions and 14 deletions
  1. 37
    14
      Marlin/src/module/stepper.cpp

+ 37
- 14
Marlin/src/module/stepper.cpp View File

1304
     #endif
1304
     #endif
1305
   #endif
1305
   #endif
1306
 
1306
 
1307
-  #define BABYSTEP_AXIS(AXIS, INVERT) {                     \
1308
-      const uint8_t old_dir = _READ_DIR(AXIS);              \
1309
-      _ENABLE(AXIS);                                        \
1310
-      _SAVE_START;                                          \
1311
-      _APPLY_DIR(AXIS, _INVERT_DIR(AXIS)^direction^INVERT); \
1312
-      _PULSE_WAIT;                                          \
1313
-      _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS), true);     \
1314
-      _PULSE_WAIT;                                          \
1315
-      _APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS), true);      \
1316
-      _APPLY_DIR(AXIS, old_dir);                            \
1307
+  #define BABYSTEP_AXIS(AXIS, INVERT, DIR) {            \
1308
+      const uint8_t old_dir = _READ_DIR(AXIS);          \
1309
+      _ENABLE(AXIS);                                    \
1310
+      _SAVE_START;                                      \
1311
+      _APPLY_DIR(AXIS, _INVERT_DIR(AXIS)^DIR^INVERT);   \
1312
+      _PULSE_WAIT;                                      \
1313
+      _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS), true); \
1314
+      _PULSE_WAIT;                                      \
1315
+      _APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS), true);  \
1316
+      _APPLY_DIR(AXIS, old_dir);                        \
1317
     }
1317
     }
1318
 
1318
 
1319
   // MUST ONLY BE CALLED BY AN ISR,
1319
   // MUST ONLY BE CALLED BY AN ISR,
1326
       #if ENABLED(BABYSTEP_XY)
1326
       #if ENABLED(BABYSTEP_XY)
1327
 
1327
 
1328
         case X_AXIS:
1328
         case X_AXIS:
1329
-          BABYSTEP_AXIS(X, false);
1329
+          #if CORE_IS_XY
1330
+            BABYSTEP_AXIS(X, false, direction);
1331
+            BABYSTEP_AXIS(Y, false, direction);
1332
+          #elif CORE_IS_XZ
1333
+            BABYSTEP_AXIS(X, false, direction);
1334
+            BABYSTEP_AXIS(Z, false, direction);
1335
+          #else
1336
+            BABYSTEP_AXIS(X, false, direction);
1337
+          #endif
1330
           break;
1338
           break;
1331
 
1339
 
1332
         case Y_AXIS:
1340
         case Y_AXIS:
1333
-          BABYSTEP_AXIS(Y, false);
1341
+          #if CORE_IS_XY
1342
+            BABYSTEP_AXIS(X, false, direction);
1343
+            BABYSTEP_AXIS(Y, false, direction^(CORESIGN(1)<0));
1344
+          #elif CORE_IS_YZ
1345
+            BABYSTEP_AXIS(Y, false, direction);
1346
+            BABYSTEP_AXIS(Z, false, direction^(CORESIGN(1)<0));
1347
+          #else
1348
+            BABYSTEP_AXIS(Y, false, direction);
1349
+          #endif
1334
           break;
1350
           break;
1335
 
1351
 
1336
       #endif
1352
       #endif
1337
 
1353
 
1338
       case Z_AXIS: {
1354
       case Z_AXIS: {
1339
 
1355
 
1340
-        #if DISABLED(DELTA)
1356
+        #if CORE_IS_XZ
1357
+          BABYSTEP_AXIS(X, BABYSTEP_INVERT_Z, direction);
1358
+          BABYSTEP_AXIS(Z, BABYSTEP_INVERT_Z, direction^(CORESIGN(1)<0));
1341
 
1359
 
1342
-          BABYSTEP_AXIS(Z, BABYSTEP_INVERT_Z);
1360
+        #elif CORE_IS_YZ
1361
+          BABYSTEP_AXIS(Y, BABYSTEP_INVERT_Z, direction);
1362
+          BABYSTEP_AXIS(Z, BABYSTEP_INVERT_Z, direction^(CORESIGN(1)<0));
1363
+
1364
+        #elif DISABLED(DELTA)
1365
+          BABYSTEP_AXIS(Z, BABYSTEP_INVERT_Z, direction);
1343
 
1366
 
1344
         #else // DELTA
1367
         #else // DELTA
1345
 
1368
 

Loading…
Cancel
Save