Browse Source

Merge pull request #5169 from thinkyhead/rc_core_inverted

Support for COREYX, COREZX, COREZY
Scott Lahteine 7 years ago
parent
commit
092e949b58
29 changed files with 198 additions and 88 deletions
  1. 24
    13
      Marlin/Conditionals_post.h
  2. 4
    0
      Marlin/Configuration.h
  3. 1
    1
      Marlin/Marlin_main.cpp
  4. 21
    6
      Marlin/SanityCheck.h
  5. 6
    6
      Marlin/endstops.cpp
  6. 4
    0
      Marlin/example_configurations/Cartesio/Configuration.h
  7. 4
    0
      Marlin/example_configurations/Felix/Configuration.h
  8. 4
    0
      Marlin/example_configurations/Felix/DUAL/Configuration.h
  9. 4
    0
      Marlin/example_configurations/Hephestos/Configuration.h
  10. 4
    0
      Marlin/example_configurations/Hephestos_2/Configuration.h
  11. 4
    0
      Marlin/example_configurations/K8200/Configuration.h
  12. 4
    0
      Marlin/example_configurations/K8400/Configuration.h
  13. 4
    0
      Marlin/example_configurations/K8400/Dual-head/Configuration.h
  14. 4
    0
      Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
  15. 4
    0
      Marlin/example_configurations/RigidBot/Configuration.h
  16. 4
    0
      Marlin/example_configurations/SCARA/Configuration.h
  17. 4
    0
      Marlin/example_configurations/TAZ4/Configuration.h
  18. 4
    0
      Marlin/example_configurations/WITBOX/Configuration.h
  19. 4
    0
      Marlin/example_configurations/adafruit/ST7565/Configuration.h
  20. 4
    0
      Marlin/example_configurations/delta/biv2.5/Configuration.h
  21. 4
    0
      Marlin/example_configurations/delta/generic/Configuration.h
  22. 4
    0
      Marlin/example_configurations/delta/kossel_mini/Configuration.h
  23. 4
    0
      Marlin/example_configurations/delta/kossel_pro/Configuration.h
  24. 4
    0
      Marlin/example_configurations/delta/kossel_xl/Configuration.h
  25. 4
    0
      Marlin/example_configurations/makibox/Configuration.h
  26. 4
    0
      Marlin/example_configurations/tvrrug/Round2/Configuration.h
  27. 32
    35
      Marlin/planner.cpp
  28. 20
    21
      Marlin/stepper.cpp
  29. 6
    6
      Marlin/temperature.h

+ 24
- 13
Marlin/Conditionals_post.h View File

@@ -39,20 +39,31 @@
39 39
   #define Z_CENTER float((Z_MIN_POS + Z_MAX_POS) * 0.5)
40 40
 
41 41
   /**
42
-   * CoreXY and CoreXZ
42
+   * CoreXY, CoreXZ, and CoreYZ - and their reverse
43 43
    */
44
-  #if ENABLED(COREXY)
45
-    #define CORE_AXIS_1 A_AXIS // XY from A + B
46
-    #define CORE_AXIS_2 B_AXIS
47
-    #define NORMAL_AXIS Z_AXIS
48
-  #elif ENABLED(COREXZ)
49
-    #define CORE_AXIS_1 A_AXIS // XZ from A + C
50
-    #define CORE_AXIS_2 C_AXIS
51
-    #define NORMAL_AXIS Y_AXIS
52
-  #elif ENABLED(COREYZ)
53
-    #define CORE_AXIS_1 B_AXIS // YZ from B + C
54
-    #define CORE_AXIS_2 C_AXIS
55
-    #define NORMAL_AXIS X_AXIS
44
+  #define CORE_IS_XY (ENABLED(COREXY) || ENABLED(COREYX))
45
+  #define CORE_IS_XZ (ENABLED(COREXZ) || ENABLED(COREZX))
46
+  #define CORE_IS_YZ (ENABLED(COREYZ) || ENABLED(COREZY))
47
+  #define IS_CORE (CORE_IS_XY || CORE_IS_XZ || CORE_IS_YZ)
48
+  #if IS_CORE
49
+    #if CORE_IS_XY
50
+      #define CORE_AXIS_1 A_AXIS
51
+      #define CORE_AXIS_2 B_AXIS
52
+      #define NORMAL_AXIS Z_AXIS
53
+    #elif CORE_IS_XZ
54
+      #define CORE_AXIS_1 A_AXIS
55
+      #define NORMAL_AXIS Y_AXIS
56
+      #define CORE_AXIS_2 C_AXIS
57
+    #elif CORE_IS_YZ
58
+      #define NORMAL_AXIS X_AXIS
59
+      #define CORE_AXIS_1 B_AXIS
60
+      #define CORE_AXIS_2 C_AXIS
61
+    #endif
62
+    #if (ENABLED(COREYX) || ENABLED(COREZX) || ENABLED(COREZY))
63
+      #define CORESIGN(n) (-(n))
64
+    #else
65
+      #define CORESIGN(n) (n)
66
+    #endif
56 67
   #endif
57 68
 
58 69
   #define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA))

+ 4
- 0
Marlin/Configuration.h View File

@@ -408,9 +408,13 @@
408 408
 // @section machine
409 409
 
410 410
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
411
+// either in the usual order or reversed
411 412
 //#define COREXY
412 413
 //#define COREXZ
413 414
 //#define COREYZ
415
+//#define COREYX
416
+//#define COREZX
417
+//#define COREZY
414 418
 
415 419
 // Enable this option for Toshiba steppers
416 420
 //#define CONFIG_STEPPERS_TOSHIBA

+ 1
- 1
Marlin/Marlin_main.cpp View File

@@ -3078,7 +3078,7 @@ inline void gcode_G4() {
3078 3078
       SERIAL_ECHOLNPGM("Delta");
3079 3079
     #elif IS_SCARA
3080 3080
       SERIAL_ECHOLNPGM("SCARA");
3081
-    #elif ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
3081
+    #elif IS_CORE
3082 3082
       SERIAL_ECHOLNPGM("Core");
3083 3083
     #else
3084 3084
       SERIAL_ECHOLNPGM("Cartesian");

+ 21
- 6
Marlin/SanityCheck.h View File

@@ -57,8 +57,8 @@
57 57
   #error "Thermal Runaway Protection for hotends is now enabled with THERMAL_PROTECTION_HOTENDS."
58 58
 #elif DISABLED(THERMAL_PROTECTION_BED) && defined(THERMAL_PROTECTION_BED_PERIOD)
59 59
   #error "Thermal Runaway Protection for the bed is now enabled with THERMAL_PROTECTION_BED."
60
-#elif ENABLED(COREXZ) && ENABLED(Z_LATE_ENABLE)
61
-  #error "Z_LATE_ENABLE can't be used with COREXZ."
60
+#elif (CORE_IS_XZ || CORE_IS_YZ) && ENABLED(Z_LATE_ENABLE)
61
+  #error "Z_LATE_ENABLE can't be used with COREXZ, COREZX, COREYZ, or COREZY."
62 62
 #elif defined(X_HOME_RETRACT_MM)
63 63
   #error "[XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM."
64 64
 #elif defined(SDCARDDETECTINVERTED)
@@ -644,8 +644,23 @@
644 644
 #else
645 645
   #define COUNT_KIN_7 COUNT_KIN_6
646 646
 #endif
647
-#if COUNT_KIN_7 > 1
648
-  #error "Please enable only one of DELTA, MORGAN_SCARA, MAKERARM_SCARA, COREXY, COREXZ, or COREYZ."
647
+#if ENABLED(COREYX)
648
+  #define COUNT_KIN_8 INCREMENT(COUNT_KIN_7)
649
+#else
650
+  #define COUNT_KIN_8 COUNT_KIN_7
651
+#endif
652
+#if ENABLED(COREZX)
653
+  #define COUNT_KIN_9 INCREMENT(COUNT_KIN_8)
654
+#else
655
+  #define COUNT_KIN_9 COUNT_KIN_8
656
+#endif
657
+#if ENABLED(COREZY)
658
+  #define COUNT_KIN_10 INCREMENT(COUNT_KIN_9)
659
+#else
660
+  #define COUNT_KIN_10 COUNT_KIN_9
661
+#endif
662
+#if COUNT_KIN_10 > 1
663
+  #error "Please enable only one of DELTA, MORGAN_SCARA, MAKERARM_SCARA, COREXY, COREYX, COREXZ, COREZX, COREYZ, or COREZY."
649 664
 #endif
650 665
 
651 666
 /**
@@ -662,8 +677,8 @@
662 677
 #if ENABLED(DUAL_X_CARRIAGE)
663 678
   #if EXTRUDERS == 1
664 679
     #error "DUAL_X_CARRIAGE requires 2 (or more) extruders."
665
-  #elif ENABLED(COREXY) || ENABLED(COREXZ)
666
-    #error "DUAL_X_CARRIAGE cannot be used with COREXY or COREXZ."
680
+  #elif CORE_IS_XY || CORE_IS_XZ
681
+    #error "DUAL_X_CARRIAGE cannot be used with COREXY, COREYX, COREXZ, or COREZX."
667 682
   #elif !HAS_X2_ENABLE || !HAS_X2_STEP || !HAS_X2_DIR
668 683
     #error "DUAL_X_CARRIAGE requires X2 stepper pins to be defined."
669 684
   #elif !HAS_X_MAX

+ 6
- 6
Marlin/endstops.cpp View File

@@ -268,7 +268,7 @@ void Endstops::update() {
268 268
 
269 269
   #endif
270 270
 
271
-  #if ENABLED(COREXY) || ENABLED(COREXZ)
271
+  #if CORE_IS_XY || CORE_IS_XZ
272 272
     // Head direction in -X axis for CoreXY and CoreXZ bots.
273 273
     // If DeltaA == -DeltaB, the movement is only in Y or Z axis
274 274
     if ((stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(CORE_AXIS_1) == stepper.motor_direction(CORE_AXIS_2))) {
@@ -298,11 +298,11 @@ void Endstops::update() {
298 298
             #endif
299 299
           }
300 300
       }
301
-  #if ENABLED(COREXY) || ENABLED(COREXZ)
301
+  #if CORE_IS_XY || CORE_IS_XZ
302 302
     }
303 303
   #endif
304 304
 
305
-  #if ENABLED(COREXY) || ENABLED(COREYZ)
305
+  #if CORE_IS_XY || CORE_IS_YZ
306 306
     // Head direction in -Y axis for CoreXY / CoreYZ bots.
307 307
     // If DeltaA == DeltaB, the movement is only in X or Y axis
308 308
     if ((stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(CORE_AXIS_1) != stepper.motor_direction(CORE_AXIS_2))) {
@@ -320,11 +320,11 @@ void Endstops::update() {
320 320
           UPDATE_ENDSTOP(Y, MAX);
321 321
         #endif
322 322
       }
323
-  #if ENABLED(COREXY) || ENABLED(COREYZ)
323
+  #if CORE_IS_XY || CORE_IS_YZ
324 324
     }
325 325
   #endif
326 326
 
327
-  #if ENABLED(COREXZ) || ENABLED(COREYZ)
327
+  #if CORE_IS_XZ || CORE_IS_YZ
328 328
     // Head direction in -Z axis for CoreXZ or CoreYZ bots.
329 329
     // If DeltaA == DeltaB, the movement is only in X or Y axis
330 330
     if ((stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(CORE_AXIS_1) != stepper.motor_direction(CORE_AXIS_2))) {
@@ -390,7 +390,7 @@ void Endstops::update() {
390 390
           #endif // !Z_MIN_PROBE_PIN...
391 391
         #endif // Z_MAX_PIN
392 392
       }
393
-  #if ENABLED(COREXZ)
393
+  #if CORE_IS_XZ || CORE_IS_YZ
394 394
     }
395 395
   #endif
396 396
 

+ 4
- 0
Marlin/example_configurations/Cartesio/Configuration.h View File

@@ -408,9 +408,13 @@
408 408
 // @section machine
409 409
 
410 410
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
411
+// either in the usual order or reversed
411 412
 //#define COREXY
412 413
 //#define COREXZ
413 414
 //#define COREYZ
415
+//#define COREYX
416
+//#define COREZX
417
+//#define COREZY
414 418
 
415 419
 // Enable this option for Toshiba steppers
416 420
 //#define CONFIG_STEPPERS_TOSHIBA

+ 4
- 0
Marlin/example_configurations/Felix/Configuration.h View File

@@ -390,9 +390,13 @@
390 390
 // @section machine
391 391
 
392 392
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
393
+// either in the usual order or reversed
393 394
 //#define COREXY
394 395
 //#define COREXZ
395 396
 //#define COREYZ
397
+//#define COREYX
398
+//#define COREZX
399
+//#define COREZY
396 400
 
397 401
 // Enable this option for Toshiba steppers
398 402
 //#define CONFIG_STEPPERS_TOSHIBA

+ 4
- 0
Marlin/example_configurations/Felix/DUAL/Configuration.h View File

@@ -390,9 +390,13 @@
390 390
 // @section machine
391 391
 
392 392
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
393
+// either in the usual order or reversed
393 394
 //#define COREXY
394 395
 //#define COREXZ
395 396
 //#define COREYZ
397
+//#define COREYX
398
+//#define COREZX
399
+//#define COREZY
396 400
 
397 401
 // Enable this option for Toshiba steppers
398 402
 //#define CONFIG_STEPPERS_TOSHIBA

+ 4
- 0
Marlin/example_configurations/Hephestos/Configuration.h View File

@@ -400,9 +400,13 @@
400 400
 // @section machine
401 401
 
402 402
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
403
+// either in the usual order or reversed
403 404
 //#define COREXY
404 405
 //#define COREXZ
405 406
 //#define COREYZ
407
+//#define COREYX
408
+//#define COREZX
409
+//#define COREZY
406 410
 
407 411
 // Enable this option for Toshiba steppers
408 412
 //#define CONFIG_STEPPERS_TOSHIBA

+ 4
- 0
Marlin/example_configurations/Hephestos_2/Configuration.h View File

@@ -402,9 +402,13 @@
402 402
 // @section machine
403 403
 
404 404
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
405
+// either in the usual order or reversed
405 406
 //#define COREXY
406 407
 //#define COREXZ
407 408
 //#define COREYZ
409
+//#define COREYX
410
+//#define COREZX
411
+//#define COREZY
408 412
 
409 413
 // Enable this option for Toshiba steppers
410 414
 //#define CONFIG_STEPPERS_TOSHIBA

+ 4
- 0
Marlin/example_configurations/K8200/Configuration.h View File

@@ -438,9 +438,13 @@
438 438
 // @section machine
439 439
 
440 440
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
441
+// either in the usual order or reversed
441 442
 //#define COREXY
442 443
 //#define COREXZ
443 444
 //#define COREYZ
445
+//#define COREYX
446
+//#define COREZX
447
+//#define COREZY
444 448
 
445 449
 // Enable this option for Toshiba steppers
446 450
 //#define CONFIG_STEPPERS_TOSHIBA

+ 4
- 0
Marlin/example_configurations/K8400/Configuration.h View File

@@ -408,9 +408,13 @@
408 408
 // @section machine
409 409
 
410 410
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
411
+// either in the usual order or reversed
411 412
 //#define COREXY
412 413
 //#define COREXZ
413 414
 //#define COREYZ
415
+//#define COREYX
416
+//#define COREZX
417
+//#define COREZY
414 418
 
415 419
 // Enable this option for Toshiba steppers
416 420
 //#define CONFIG_STEPPERS_TOSHIBA

+ 4
- 0
Marlin/example_configurations/K8400/Dual-head/Configuration.h View File

@@ -408,9 +408,13 @@
408 408
 // @section machine
409 409
 
410 410
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
411
+// either in the usual order or reversed
411 412
 //#define COREXY
412 413
 //#define COREXZ
413 414
 //#define COREYZ
415
+//#define COREYX
416
+//#define COREZX
417
+//#define COREZY
414 418
 
415 419
 // Enable this option for Toshiba steppers
416 420
 //#define CONFIG_STEPPERS_TOSHIBA

+ 4
- 0
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h View File

@@ -408,9 +408,13 @@
408 408
 // @section machine
409 409
 
410 410
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
411
+// either in the usual order or reversed
411 412
 //#define COREXY
412 413
 //#define COREXZ
413 414
 //#define COREYZ
415
+//#define COREYX
416
+//#define COREZX
417
+//#define COREZY
414 418
 
415 419
 // Enable this option for Toshiba steppers
416 420
 //#define CONFIG_STEPPERS_TOSHIBA

+ 4
- 0
Marlin/example_configurations/RigidBot/Configuration.h View File

@@ -405,9 +405,13 @@
405 405
 // @section machine
406 406
 
407 407
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
408
+// either in the usual order or reversed
408 409
 //#define COREXY
409 410
 //#define COREXZ
410 411
 //#define COREYZ
412
+//#define COREYX
413
+//#define COREZX
414
+//#define COREZY
411 415
 
412 416
 // Enable this option for Toshiba steppers
413 417
 //#define CONFIG_STEPPERS_TOSHIBA

+ 4
- 0
Marlin/example_configurations/SCARA/Configuration.h View File

@@ -423,9 +423,13 @@
423 423
 // @section machine
424 424
 
425 425
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
426
+// either in the usual order or reversed
426 427
 //#define COREXY
427 428
 //#define COREXZ
428 429
 //#define COREYZ
430
+//#define COREYX
431
+//#define COREZX
432
+//#define COREZY
429 433
 
430 434
 // Enable this option for Toshiba steppers
431 435
 //#define CONFIG_STEPPERS_TOSHIBA

+ 4
- 0
Marlin/example_configurations/TAZ4/Configuration.h View File

@@ -429,9 +429,13 @@
429 429
 // @section machine
430 430
 
431 431
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
432
+// either in the usual order or reversed
432 433
 //#define COREXY
433 434
 //#define COREXZ
434 435
 //#define COREYZ
436
+//#define COREYX
437
+//#define COREZX
438
+//#define COREZY
435 439
 
436 440
 // Enable this option for Toshiba steppers
437 441
 //#define CONFIG_STEPPERS_TOSHIBA

+ 4
- 0
Marlin/example_configurations/WITBOX/Configuration.h View File

@@ -400,9 +400,13 @@
400 400
 // @section machine
401 401
 
402 402
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
403
+// either in the usual order or reversed
403 404
 //#define COREXY
404 405
 //#define COREXZ
405 406
 //#define COREYZ
407
+//#define COREYX
408
+//#define COREZX
409
+//#define COREZY
406 410
 
407 411
 // Enable this option for Toshiba steppers
408 412
 //#define CONFIG_STEPPERS_TOSHIBA

+ 4
- 0
Marlin/example_configurations/adafruit/ST7565/Configuration.h View File

@@ -408,9 +408,13 @@
408 408
 // @section machine
409 409
 
410 410
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
411
+// either in the usual order or reversed
411 412
 //#define COREXY
412 413
 //#define COREXZ
413 414
 //#define COREYZ
415
+//#define COREYX
416
+//#define COREZX
417
+//#define COREZY
414 418
 
415 419
 // Enable this option for Toshiba steppers
416 420
 //#define CONFIG_STEPPERS_TOSHIBA

+ 4
- 0
Marlin/example_configurations/delta/biv2.5/Configuration.h View File

@@ -408,9 +408,13 @@
408 408
 // @section machine
409 409
 
410 410
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
411
+// either in the usual order or reversed
411 412
 //#define COREXY
412 413
 //#define COREXZ
413 414
 //#define COREYZ
415
+//#define COREYX
416
+//#define COREZX
417
+//#define COREZY
414 418
 
415 419
 //===========================================================================
416 420
 //============================== Delta Settings =============================

+ 4
- 0
Marlin/example_configurations/delta/generic/Configuration.h View File

@@ -408,9 +408,13 @@
408 408
 // @section machine
409 409
 
410 410
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
411
+// either in the usual order or reversed
411 412
 //#define COREXY
412 413
 //#define COREXZ
413 414
 //#define COREYZ
415
+//#define COREYX
416
+//#define COREZX
417
+//#define COREZY
414 418
 
415 419
 //===========================================================================
416 420
 //============================== Delta Settings =============================

+ 4
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration.h View File

@@ -408,9 +408,13 @@
408 408
 // @section machine
409 409
 
410 410
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
411
+// either in the usual order or reversed
411 412
 //#define COREXY
412 413
 //#define COREXZ
413 414
 //#define COREYZ
415
+//#define COREYX
416
+//#define COREZX
417
+//#define COREZY
414 418
 
415 419
 //===========================================================================
416 420
 //============================== Delta Settings =============================

+ 4
- 0
Marlin/example_configurations/delta/kossel_pro/Configuration.h View File

@@ -395,9 +395,13 @@
395 395
 // @section machine
396 396
 
397 397
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
398
+// either in the usual order or reversed
398 399
 //#define COREXY
399 400
 //#define COREXZ
400 401
 //#define COREYZ
402
+//#define COREYX
403
+//#define COREZX
404
+//#define COREZY
401 405
 
402 406
 //===========================================================================
403 407
 //============================== Delta Settings =============================

+ 4
- 0
Marlin/example_configurations/delta/kossel_xl/Configuration.h View File

@@ -406,9 +406,13 @@
406 406
 // @section machine
407 407
 
408 408
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
409
+// either in the usual order or reversed
409 410
 //#define COREXY
410 411
 //#define COREXZ
411 412
 //#define COREYZ
413
+//#define COREYX
414
+//#define COREZX
415
+//#define COREZY
412 416
 
413 417
 //===========================================================================
414 418
 //============================== Delta Settings =============================

+ 4
- 0
Marlin/example_configurations/makibox/Configuration.h View File

@@ -411,9 +411,13 @@
411 411
 // @section machine
412 412
 
413 413
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
414
+// either in the usual order or reversed
414 415
 //#define COREXY
415 416
 //#define COREXZ
416 417
 //#define COREYZ
418
+//#define COREYX
419
+//#define COREZX
420
+//#define COREZY
417 421
 
418 422
 // Enable this option for Toshiba steppers
419 423
 //#define CONFIG_STEPPERS_TOSHIBA

+ 4
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

@@ -398,9 +398,13 @@
398 398
 // @section machine
399 399
 
400 400
 // Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
401
+// either in the usual order or reversed
401 402
 //#define COREXY
402 403
 //#define COREXZ
403 404
 //#define COREYZ
405
+//#define COREYX
406
+//#define COREZX
407
+//#define COREZY
404 408
 
405 409
 // Enable this option for Toshiba steppers
406 410
 #define CONFIG_STEPPERS_TOSHIBA

+ 32
- 35
Marlin/planner.cpp View File

@@ -712,24 +712,24 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
712 712
 
713 713
   // Compute direction bit-mask for this block
714 714
   uint8_t dm = 0;
715
-  #if ENABLED(COREXY)
716
-    if (da < 0) SBI(dm, X_HEAD); // Save the real Extruder (head) direction in X Axis
717
-    if (db < 0) SBI(dm, Y_HEAD); // ...and Y
715
+  #if CORE_IS_XY
716
+    if (da < 0) SBI(dm, X_HEAD);                // Save the real Extruder (head) direction in X Axis
717
+    if (db < 0) SBI(dm, Y_HEAD);                // ...and Y
718 718
     if (dc < 0) SBI(dm, Z_AXIS);
719
-    if (da + db < 0) SBI(dm, A_AXIS); // Motor A direction
720
-    if (da - db < 0) SBI(dm, B_AXIS); // Motor B direction
721
-  #elif ENABLED(COREXZ)
722
-    if (da < 0) SBI(dm, X_HEAD); // Save the real Extruder (head) direction in X Axis
719
+    if (da + db < 0) SBI(dm, A_AXIS);           // Motor A direction
720
+    if (CORESIGN(da - db) < 0) SBI(dm, B_AXIS); // Motor B direction
721
+  #elif CORE_IS_XZ
722
+    if (da < 0) SBI(dm, X_HEAD);                // Save the real Extruder (head) direction in X Axis
723 723
     if (db < 0) SBI(dm, Y_AXIS);
724
-    if (dc < 0) SBI(dm, Z_HEAD); // ...and Z
725
-    if (da + dc < 0) SBI(dm, A_AXIS); // Motor A direction
726
-    if (da - dc < 0) SBI(dm, C_AXIS); // Motor C direction
727
-  #elif ENABLED(COREYZ)
724
+    if (dc < 0) SBI(dm, Z_HEAD);                // ...and Z
725
+    if (da + dc < 0) SBI(dm, A_AXIS);           // Motor A direction
726
+    if (CORESIGN(da - dc) < 0) SBI(dm, C_AXIS); // Motor C direction
727
+  #elif CORE_IS_YZ
728 728
     if (da < 0) SBI(dm, X_AXIS);
729
-    if (db < 0) SBI(dm, Y_HEAD); // Save the real Extruder (head) direction in Y Axis
730
-    if (dc < 0) SBI(dm, Z_HEAD); // ...and Z
731
-    if (db + dc < 0) SBI(dm, B_AXIS); // Motor B direction
732
-    if (db - dc < 0) SBI(dm, C_AXIS); // Motor C direction
729
+    if (db < 0) SBI(dm, Y_HEAD);                // Save the real Extruder (head) direction in Y Axis
730
+    if (dc < 0) SBI(dm, Z_HEAD);                // ...and Z
731
+    if (db + dc < 0) SBI(dm, B_AXIS);           // Motor B direction
732
+    if (CORESIGN(db - dc) < 0) SBI(dm, C_AXIS); // Motor C direction
733 733
   #else
734 734
     if (da < 0) SBI(dm, X_AXIS);
735 735
     if (db < 0) SBI(dm, Y_AXIS);
@@ -757,19 +757,16 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
757 757
   block->direction_bits = dm;
758 758
 
759 759
   // Number of steps for each axis
760
-  #if ENABLED(COREXY)
761
-    // corexy planning
762
-    // these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
760
+  // See http://www.corexy.com/theory.html
761
+  #if CORE_IS_XY
763 762
     block->steps[A_AXIS] = labs(da + db);
764 763
     block->steps[B_AXIS] = labs(da - db);
765 764
     block->steps[Z_AXIS] = labs(dc);
766
-  #elif ENABLED(COREXZ)
767
-    // corexz planning
765
+  #elif CORE_IS_XZ
768 766
     block->steps[A_AXIS] = labs(da + dc);
769 767
     block->steps[Y_AXIS] = labs(db);
770 768
     block->steps[C_AXIS] = labs(da - dc);
771
-  #elif ENABLED(COREYZ)
772
-    // coreyz planning
769
+  #elif CORE_IS_YZ
773 770
     block->steps[X_AXIS] = labs(da);
774 771
     block->steps[B_AXIS] = labs(db + dc);
775 772
     block->steps[C_AXIS] = labs(db - dc);
@@ -804,7 +801,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
804 801
   block->active_extruder = extruder;
805 802
 
806 803
   //enable active axes
807
-  #if ENABLED(COREXY)
804
+  #if CORE_IS_XY
808 805
     if (block->steps[A_AXIS] || block->steps[B_AXIS]) {
809 806
       enable_x();
810 807
       enable_y();
@@ -812,13 +809,13 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
812 809
     #if DISABLED(Z_LATE_ENABLE)
813 810
       if (block->steps[Z_AXIS]) enable_z();
814 811
     #endif
815
-  #elif ENABLED(COREXZ)
812
+  #elif CORE_IS_XZ
816 813
     if (block->steps[A_AXIS] || block->steps[C_AXIS]) {
817 814
       enable_x();
818 815
       enable_z();
819 816
     }
820 817
     if (block->steps[Y_AXIS]) enable_y();
821
-  #elif ENABLED(COREYZ)
818
+  #elif CORE_IS_YZ
822 819
     if (block->steps[B_AXIS] || block->steps[C_AXIS]) {
823 820
       enable_y();
824 821
       enable_z();
@@ -915,26 +912,26 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
915 912
    * So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head.
916 913
    * Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
917 914
    */
918
-  #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
915
+  #if IS_CORE
919 916
     float delta_mm[7];
920
-    #if ENABLED(COREXY)
917
+    #if CORE_IS_XY
921 918
       delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS];
922 919
       delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS];
923 920
       delta_mm[Z_AXIS] = dc * steps_to_mm[Z_AXIS];
924 921
       delta_mm[A_AXIS] = (da + db) * steps_to_mm[A_AXIS];
925
-      delta_mm[B_AXIS] = (da - db) * steps_to_mm[B_AXIS];
926
-    #elif ENABLED(COREXZ)
922
+      delta_mm[B_AXIS] = CORESIGN(da - db) * steps_to_mm[B_AXIS];
923
+    #elif CORE_IS_XZ
927 924
       delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS];
928 925
       delta_mm[Y_AXIS] = db * steps_to_mm[Y_AXIS];
929 926
       delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS];
930 927
       delta_mm[A_AXIS] = (da + dc) * steps_to_mm[A_AXIS];
931
-      delta_mm[C_AXIS] = (da - dc) * steps_to_mm[C_AXIS];
932
-    #elif ENABLED(COREYZ)
928
+      delta_mm[C_AXIS] = CORESIGN(da - dc) * steps_to_mm[C_AXIS];
929
+    #elif CORE_IS_YZ
933 930
       delta_mm[X_AXIS] = da * steps_to_mm[X_AXIS];
934 931
       delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS];
935 932
       delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS];
936 933
       delta_mm[B_AXIS] = (db + dc) * steps_to_mm[B_AXIS];
937
-      delta_mm[C_AXIS] = (db - dc) * steps_to_mm[C_AXIS];
934
+      delta_mm[C_AXIS] = CORESIGN(db - dc) * steps_to_mm[C_AXIS];
938 935
     #endif
939 936
   #else
940 937
     float delta_mm[4];
@@ -949,11 +946,11 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
949 946
   }
950 947
   else {
951 948
     block->millimeters = sqrt(
952
-      #if ENABLED(COREXY)
949
+      #if CORE_IS_XY
953 950
         sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_AXIS])
954
-      #elif ENABLED(COREXZ)
951
+      #elif CORE_IS_XZ
955 952
         sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_HEAD])
956
-      #elif ENABLED(COREYZ)
953
+      #elif CORE_IS_YZ
957 954
         sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_HEAD])
958 955
       #else
959 956
         sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_AXIS])

+ 20
- 21
Marlin/stepper.cpp View File

@@ -991,22 +991,22 @@ void Stepper::set_position(const long &a, const long &b, const long &c, const lo
991 991
 
992 992
   CRITICAL_SECTION_START;
993 993
 
994
-  #if ENABLED(COREXY)
994
+  #if CORE_IS_XY
995 995
     // corexy positioning
996 996
     // these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
997 997
     count_position[A_AXIS] = a + b;
998
-    count_position[B_AXIS] = a - b;
998
+    count_position[B_AXIS] = CORESIGN(a - b);
999 999
     count_position[Z_AXIS] = c;
1000
-  #elif ENABLED(COREXZ)
1000
+  #elif CORE_IS_XZ
1001 1001
     // corexz planning
1002 1002
     count_position[A_AXIS] = a + c;
1003 1003
     count_position[Y_AXIS] = b;
1004
-    count_position[C_AXIS] = a - c;
1005
-  #elif ENABLED(COREYZ)
1004
+    count_position[C_AXIS] = CORESIGN(a - c);
1005
+  #elif CORE_IS_YZ
1006 1006
     // coreyz planning
1007 1007
     count_position[X_AXIS] = a;
1008 1008
     count_position[B_AXIS] = b + c;
1009
-    count_position[C_AXIS] = b - c;
1009
+    count_position[C_AXIS] = CORESIGN(b - c);
1010 1010
   #else
1011 1011
     // default non-h-bot planning
1012 1012
     count_position[X_AXIS] = a;
@@ -1046,16 +1046,17 @@ long Stepper::position(AxisEnum axis) {
1046 1046
  */
1047 1047
 float Stepper::get_axis_position_mm(AxisEnum axis) {
1048 1048
   float axis_steps;
1049
-  #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
1049
+  #if IS_CORE
1050 1050
     // Requesting one of the "core" axes?
1051 1051
     if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) {
1052 1052
       CRITICAL_SECTION_START;
1053
-      long pos1 = count_position[CORE_AXIS_1],
1054
-           pos2 = count_position[CORE_AXIS_2];
1055
-      CRITICAL_SECTION_END;
1056 1053
       // ((a1+a2)+(a1-a2))/2 -> (a1+a2+a1-a2)/2 -> (a1+a1)/2 -> a1
1057 1054
       // ((a1+a2)-(a1-a2))/2 -> (a1+a2-a1+a2)/2 -> (a2+a2)/2 -> a2
1058
-      axis_steps = (pos1 + ((axis == CORE_AXIS_1) ? pos2 : -pos2)) * 0.5f;
1055
+      axis_steps = 0.5f * (
1056
+        axis == CORE_AXIS_2 ? CORESIGN(count_position[CORE_AXIS_1] - count_position[CORE_AXIS_2])
1057
+                            : count_position[CORE_AXIS_1] + count_position[CORE_AXIS_2]
1058
+      );
1059
+      CRITICAL_SECTION_END;
1059 1060
     }
1060 1061
     else
1061 1062
       axis_steps = position(axis);
@@ -1083,14 +1084,12 @@ void Stepper::quick_stop() {
1083 1084
 
1084 1085
 void Stepper::endstop_triggered(AxisEnum axis) {
1085 1086
 
1086
-  #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
1087
+  #if IS_CORE
1087 1088
 
1088
-    float axis_pos = count_position[axis];
1089
-    if (axis == CORE_AXIS_1)
1090
-      axis_pos = (axis_pos + count_position[CORE_AXIS_2]) * 0.5;
1091
-    else if (axis == CORE_AXIS_2)
1092
-      axis_pos = (count_position[CORE_AXIS_1] - axis_pos) * 0.5;
1093
-    endstops_trigsteps[axis] = axis_pos;
1089
+    endstops_trigsteps[axis] = 0.5f * (
1090
+      axis == CORE_AXIS_2 ? CORESIGN(count_position[CORE_AXIS_1] - count_position[CORE_AXIS_2])
1091
+                          : count_position[CORE_AXIS_1] + count_position[CORE_AXIS_2]
1092
+    );
1094 1093
 
1095 1094
   #else // !COREXY && !COREXZ && !COREYZ
1096 1095
 
@@ -1108,21 +1107,21 @@ void Stepper::report_positions() {
1108 1107
        zpos = count_position[Z_AXIS];
1109 1108
   CRITICAL_SECTION_END;
1110 1109
 
1111
-  #if ENABLED(COREXY) || ENABLED(COREXZ) || IS_SCARA
1110
+  #if CORE_IS_XY || CORE_IS_XZ || IS_SCARA
1112 1111
     SERIAL_PROTOCOLPGM(MSG_COUNT_A);
1113 1112
   #else
1114 1113
     SERIAL_PROTOCOLPGM(MSG_COUNT_X);
1115 1114
   #endif
1116 1115
   SERIAL_PROTOCOL(xpos);
1117 1116
 
1118
-  #if ENABLED(COREXY) || ENABLED(COREYZ) || IS_SCARA
1117
+  #if CORE_IS_XY || CORE_IS_YZ || IS_SCARA
1119 1118
     SERIAL_PROTOCOLPGM(" B:");
1120 1119
   #else
1121 1120
     SERIAL_PROTOCOLPGM(" Y:");
1122 1121
   #endif
1123 1122
   SERIAL_PROTOCOL(ypos);
1124 1123
 
1125
-  #if ENABLED(COREXZ) || ENABLED(COREYZ)
1124
+  #if CORE_IS_XZ || CORE_IS_YZ
1126 1125
     SERIAL_PROTOCOLPGM(" C:");
1127 1126
   #else
1128 1127
     SERIAL_PROTOCOLPGM(" Z:");

+ 6
- 6
Marlin/temperature.h View File

@@ -385,7 +385,7 @@ class Temperature {
385 385
     #if ENABLED(BABYSTEPPING)
386 386
 
387 387
       static void babystep_axis(const AxisEnum axis, const int distance) {
388
-        #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
388
+        #if IS_CORE
389 389
           #if ENABLED(BABYSTEP_XY)
390 390
             switch (axis) {
391 391
               case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ
@@ -393,17 +393,17 @@ class Temperature {
393 393
                 babystepsTodo[CORE_AXIS_2] += distance * 2;
394 394
                 break;
395 395
               case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ
396
-                babystepsTodo[CORE_AXIS_1] += distance * 2;
397
-                babystepsTodo[CORE_AXIS_2] -= distance * 2;
396
+                babystepsTodo[CORE_AXIS_1] += CORESIGN(distance * 2);
397
+                babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2);
398 398
                 break;
399 399
               case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ
400 400
                 babystepsTodo[NORMAL_AXIS] += distance;
401 401
                 break;
402 402
             }
403
-          #elif ENABLED(COREXZ) || ENABLED(COREYZ)
403
+          #elif CORE_IS_XZ || CORE_IS_YZ
404 404
             // Only Z stepping needs to be handled here
405
-            babystepsTodo[CORE_AXIS_1] += distance * 2;
406
-            babystepsTodo[CORE_AXIS_2] -= distance * 2;
405
+            babystepsTodo[CORE_AXIS_1] += CORESIGN(distance * 2);
406
+            babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2);
407 407
           #else
408 408
             babystepsTodo[Z_AXIS] += distance;
409 409
           #endif

Loading…
Cancel
Save