Przeglądaj źródła

Merge pull request #5169 from thinkyhead/rc_core_inverted

Support for COREYX, COREZX, COREZY
Scott Lahteine 8 lat temu
rodzic
commit
092e949b58
29 zmienionych plików z 198 dodań i 88 usunięć
  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 Wyświetl plik

39
   #define Z_CENTER float((Z_MIN_POS + Z_MAX_POS) * 0.5)
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
   #endif
67
   #endif
57
 
68
 
58
   #define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA))
69
   #define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA))

+ 4
- 0
Marlin/Configuration.h Wyświetl plik

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

+ 1
- 1
Marlin/Marlin_main.cpp Wyświetl plik

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

+ 21
- 6
Marlin/SanityCheck.h Wyświetl plik

57
   #error "Thermal Runaway Protection for hotends is now enabled with THERMAL_PROTECTION_HOTENDS."
57
   #error "Thermal Runaway Protection for hotends is now enabled with THERMAL_PROTECTION_HOTENDS."
58
 #elif DISABLED(THERMAL_PROTECTION_BED) && defined(THERMAL_PROTECTION_BED_PERIOD)
58
 #elif DISABLED(THERMAL_PROTECTION_BED) && defined(THERMAL_PROTECTION_BED_PERIOD)
59
   #error "Thermal Runaway Protection for the bed is now enabled with THERMAL_PROTECTION_BED."
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
 #elif defined(X_HOME_RETRACT_MM)
62
 #elif defined(X_HOME_RETRACT_MM)
63
   #error "[XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM."
63
   #error "[XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM."
64
 #elif defined(SDCARDDETECTINVERTED)
64
 #elif defined(SDCARDDETECTINVERTED)
644
 #else
644
 #else
645
   #define COUNT_KIN_7 COUNT_KIN_6
645
   #define COUNT_KIN_7 COUNT_KIN_6
646
 #endif
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
 #endif
664
 #endif
650
 
665
 
651
 /**
666
 /**
662
 #if ENABLED(DUAL_X_CARRIAGE)
677
 #if ENABLED(DUAL_X_CARRIAGE)
663
   #if EXTRUDERS == 1
678
   #if EXTRUDERS == 1
664
     #error "DUAL_X_CARRIAGE requires 2 (or more) extruders."
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
   #elif !HAS_X2_ENABLE || !HAS_X2_STEP || !HAS_X2_DIR
682
   #elif !HAS_X2_ENABLE || !HAS_X2_STEP || !HAS_X2_DIR
668
     #error "DUAL_X_CARRIAGE requires X2 stepper pins to be defined."
683
     #error "DUAL_X_CARRIAGE requires X2 stepper pins to be defined."
669
   #elif !HAS_X_MAX
684
   #elif !HAS_X_MAX

+ 6
- 6
Marlin/endstops.cpp Wyświetl plik

268
 
268
 
269
   #endif
269
   #endif
270
 
270
 
271
-  #if ENABLED(COREXY) || ENABLED(COREXZ)
271
+  #if CORE_IS_XY || CORE_IS_XZ
272
     // Head direction in -X axis for CoreXY and CoreXZ bots.
272
     // Head direction in -X axis for CoreXY and CoreXZ bots.
273
     // If DeltaA == -DeltaB, the movement is only in Y or Z axis
273
     // If DeltaA == -DeltaB, the movement is only in Y or Z axis
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))) {
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
             #endif
298
             #endif
299
           }
299
           }
300
       }
300
       }
301
-  #if ENABLED(COREXY) || ENABLED(COREXZ)
301
+  #if CORE_IS_XY || CORE_IS_XZ
302
     }
302
     }
303
   #endif
303
   #endif
304
 
304
 
305
-  #if ENABLED(COREXY) || ENABLED(COREYZ)
305
+  #if CORE_IS_XY || CORE_IS_YZ
306
     // Head direction in -Y axis for CoreXY / CoreYZ bots.
306
     // Head direction in -Y axis for CoreXY / CoreYZ bots.
307
     // If DeltaA == DeltaB, the movement is only in X or Y axis
307
     // If DeltaA == DeltaB, the movement is only in X or Y axis
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))) {
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
           UPDATE_ENDSTOP(Y, MAX);
320
           UPDATE_ENDSTOP(Y, MAX);
321
         #endif
321
         #endif
322
       }
322
       }
323
-  #if ENABLED(COREXY) || ENABLED(COREYZ)
323
+  #if CORE_IS_XY || CORE_IS_YZ
324
     }
324
     }
325
   #endif
325
   #endif
326
 
326
 
327
-  #if ENABLED(COREXZ) || ENABLED(COREYZ)
327
+  #if CORE_IS_XZ || CORE_IS_YZ
328
     // Head direction in -Z axis for CoreXZ or CoreYZ bots.
328
     // Head direction in -Z axis for CoreXZ or CoreYZ bots.
329
     // If DeltaA == DeltaB, the movement is only in X or Y axis
329
     // If DeltaA == DeltaB, the movement is only in X or Y axis
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))) {
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
           #endif // !Z_MIN_PROBE_PIN...
390
           #endif // !Z_MIN_PROBE_PIN...
391
         #endif // Z_MAX_PIN
391
         #endif // Z_MAX_PIN
392
       }
392
       }
393
-  #if ENABLED(COREXZ)
393
+  #if CORE_IS_XZ || CORE_IS_YZ
394
     }
394
     }
395
   #endif
395
   #endif
396
 
396
 

+ 4
- 0
Marlin/example_configurations/Cartesio/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/Felix/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/Felix/DUAL/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/Hephestos/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/Hephestos_2/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/K8200/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/K8400/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/K8400/Dual-head/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/RigidBot/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/SCARA/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/TAZ4/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/WITBOX/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/adafruit/ST7565/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/delta/biv2.5/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/delta/generic/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/delta/kossel_pro/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/delta/kossel_xl/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/makibox/Configuration.h Wyświetl plik

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

+ 4
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration.h Wyświetl plik

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

+ 32
- 35
Marlin/planner.cpp Wyświetl plik

712
 
712
 
713
   // Compute direction bit-mask for this block
713
   // Compute direction bit-mask for this block
714
   uint8_t dm = 0;
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
     if (dc < 0) SBI(dm, Z_AXIS);
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
     if (db < 0) SBI(dm, Y_AXIS);
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
     if (da < 0) SBI(dm, X_AXIS);
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
   #else
733
   #else
734
     if (da < 0) SBI(dm, X_AXIS);
734
     if (da < 0) SBI(dm, X_AXIS);
735
     if (db < 0) SBI(dm, Y_AXIS);
735
     if (db < 0) SBI(dm, Y_AXIS);
757
   block->direction_bits = dm;
757
   block->direction_bits = dm;
758
 
758
 
759
   // Number of steps for each axis
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
     block->steps[A_AXIS] = labs(da + db);
762
     block->steps[A_AXIS] = labs(da + db);
764
     block->steps[B_AXIS] = labs(da - db);
763
     block->steps[B_AXIS] = labs(da - db);
765
     block->steps[Z_AXIS] = labs(dc);
764
     block->steps[Z_AXIS] = labs(dc);
766
-  #elif ENABLED(COREXZ)
767
-    // corexz planning
765
+  #elif CORE_IS_XZ
768
     block->steps[A_AXIS] = labs(da + dc);
766
     block->steps[A_AXIS] = labs(da + dc);
769
     block->steps[Y_AXIS] = labs(db);
767
     block->steps[Y_AXIS] = labs(db);
770
     block->steps[C_AXIS] = labs(da - dc);
768
     block->steps[C_AXIS] = labs(da - dc);
771
-  #elif ENABLED(COREYZ)
772
-    // coreyz planning
769
+  #elif CORE_IS_YZ
773
     block->steps[X_AXIS] = labs(da);
770
     block->steps[X_AXIS] = labs(da);
774
     block->steps[B_AXIS] = labs(db + dc);
771
     block->steps[B_AXIS] = labs(db + dc);
775
     block->steps[C_AXIS] = labs(db - dc);
772
     block->steps[C_AXIS] = labs(db - dc);
804
   block->active_extruder = extruder;
801
   block->active_extruder = extruder;
805
 
802
 
806
   //enable active axes
803
   //enable active axes
807
-  #if ENABLED(COREXY)
804
+  #if CORE_IS_XY
808
     if (block->steps[A_AXIS] || block->steps[B_AXIS]) {
805
     if (block->steps[A_AXIS] || block->steps[B_AXIS]) {
809
       enable_x();
806
       enable_x();
810
       enable_y();
807
       enable_y();
812
     #if DISABLED(Z_LATE_ENABLE)
809
     #if DISABLED(Z_LATE_ENABLE)
813
       if (block->steps[Z_AXIS]) enable_z();
810
       if (block->steps[Z_AXIS]) enable_z();
814
     #endif
811
     #endif
815
-  #elif ENABLED(COREXZ)
812
+  #elif CORE_IS_XZ
816
     if (block->steps[A_AXIS] || block->steps[C_AXIS]) {
813
     if (block->steps[A_AXIS] || block->steps[C_AXIS]) {
817
       enable_x();
814
       enable_x();
818
       enable_z();
815
       enable_z();
819
     }
816
     }
820
     if (block->steps[Y_AXIS]) enable_y();
817
     if (block->steps[Y_AXIS]) enable_y();
821
-  #elif ENABLED(COREYZ)
818
+  #elif CORE_IS_YZ
822
     if (block->steps[B_AXIS] || block->steps[C_AXIS]) {
819
     if (block->steps[B_AXIS] || block->steps[C_AXIS]) {
823
       enable_y();
820
       enable_y();
824
       enable_z();
821
       enable_z();
915
    * So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head.
912
    * So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head.
916
    * Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
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
     float delta_mm[7];
916
     float delta_mm[7];
920
-    #if ENABLED(COREXY)
917
+    #if CORE_IS_XY
921
       delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS];
918
       delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS];
922
       delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS];
919
       delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS];
923
       delta_mm[Z_AXIS] = dc * steps_to_mm[Z_AXIS];
920
       delta_mm[Z_AXIS] = dc * steps_to_mm[Z_AXIS];
924
       delta_mm[A_AXIS] = (da + db) * steps_to_mm[A_AXIS];
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
       delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS];
924
       delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS];
928
       delta_mm[Y_AXIS] = db * steps_to_mm[Y_AXIS];
925
       delta_mm[Y_AXIS] = db * steps_to_mm[Y_AXIS];
929
       delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS];
926
       delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS];
930
       delta_mm[A_AXIS] = (da + dc) * steps_to_mm[A_AXIS];
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
       delta_mm[X_AXIS] = da * steps_to_mm[X_AXIS];
930
       delta_mm[X_AXIS] = da * steps_to_mm[X_AXIS];
934
       delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS];
931
       delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS];
935
       delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS];
932
       delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS];
936
       delta_mm[B_AXIS] = (db + dc) * steps_to_mm[B_AXIS];
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
     #endif
935
     #endif
939
   #else
936
   #else
940
     float delta_mm[4];
937
     float delta_mm[4];
949
   }
946
   }
950
   else {
947
   else {
951
     block->millimeters = sqrt(
948
     block->millimeters = sqrt(
952
-      #if ENABLED(COREXY)
949
+      #if CORE_IS_XY
953
         sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_AXIS])
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
         sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_HEAD])
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
         sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_HEAD])
954
         sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_HEAD])
958
       #else
955
       #else
959
         sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_AXIS])
956
         sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_AXIS])

+ 20
- 21
Marlin/stepper.cpp Wyświetl plik

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

+ 6
- 6
Marlin/temperature.h Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz