Преглед изворни кода

Patches for core motion tests

Scott Lahteine пре 6 година
родитељ
комит
9644d56b42
4 измењених фајлова са 20 додато и 21 уклоњено
  1. 3
    4
      Marlin/src/core/enum.h
  2. 1
    1
      Marlin/src/core/macros.h
  3. 6
    6
      Marlin/src/module/endstops.cpp
  4. 10
    10
      Marlin/src/module/stepper.cpp

+ 3
- 4
Marlin/src/core/enum.h Прегледај датотеку

26
 /**
26
 /**
27
  * Axis indices as enumerated constants
27
  * Axis indices as enumerated constants
28
  *
28
  *
29
- * Special axis:
30
- *  - A_AXIS and B_AXIS are used by COREXY printers
31
- *  - X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship
32
- *    between X_AXIS and X Head movement, like CoreXY bots
29
+ *  - X_AXIS, Y_AXIS, and Z_AXIS should be used for axes in Cartesian space
30
+ *  - A_AXIS, B_AXIS, and C_AXIS should be used for Steppers, corresponding to XYZ on Cartesians
31
+ *  - X_HEAD, Y_HEAD, and Z_HEAD should be used for Steppers on Core kinematics
33
  */
32
  */
34
 enum AxisEnum : unsigned char {
33
 enum AxisEnum : unsigned char {
35
   X_AXIS    = 0,
34
   X_AXIS    = 0,

+ 1
- 1
Marlin/src/core/macros.h Прегледај датотеку

71
 #define TEST(n,b) !!((n)&_BV(b))
71
 #define TEST(n,b) !!((n)&_BV(b))
72
 #define SBI(n,b) (n |= _BV(b))
72
 #define SBI(n,b) (n |= _BV(b))
73
 #define CBI(n,b) (n &= ~_BV(b))
73
 #define CBI(n,b) (n &= ~_BV(b))
74
-#define SET_BIT(N,B,TF) do{ if (TF) SBI(N,B); else CBI(N,B); }while(0)
74
+#define SET_BIT_TO(N,B,TF) do{ if (TF) SBI(N,B); else CBI(N,B); }while(0)
75
 
75
 
76
 #define _BV32(b) (1UL << (b))
76
 #define _BV32(b) (1UL << (b))
77
 #define TEST32(n,b) !!((n)&_BV32(b))
77
 #define TEST32(n,b) !!((n)&_BV32(b))

+ 6
- 6
Marlin/src/module/endstops.cpp Прегледај датотеку

405
 // Check endstops - Could be called from ISR!
405
 // Check endstops - Could be called from ISR!
406
 void Endstops::update() {
406
 void Endstops::update() {
407
 
407
 
408
-  #define SET_BIT(N,B,TF) do{ if (TF) SBI(N,B); else CBI(N,B); }while(0)
408
+  #define SET_BIT_TO(N,B,TF) do{ if (TF) SBI(N,B); else CBI(N,B); }while(0)
409
   // UPDATE_ENDSTOP_BIT: set the current endstop bits for an endstop to its status
409
   // UPDATE_ENDSTOP_BIT: set the current endstop bits for an endstop to its status
410
-  #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
410
+  #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
411
   // COPY_BIT: copy the value of SRC_BIT to DST_BIT in DST
411
   // COPY_BIT: copy the value of SRC_BIT to DST_BIT in DST
412
-  #define COPY_BIT(DST, SRC_BIT, DST_BIT) SET_BIT(DST, DST_BIT, TEST(DST, SRC_BIT))
412
+  #define COPY_BIT(DST, SRC_BIT, DST_BIT) SET_BIT_TO(DST, DST_BIT, TEST(DST, SRC_BIT))
413
 
413
 
414
   #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ)
414
   #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ)
415
     // If G38 command is active check Z_MIN_PROBE for ALL movement
415
     // If G38 command is active check Z_MIN_PROBE for ALL movement
605
     // If G38 command is active check Z_MIN_PROBE for ALL movement
605
     // If G38 command is active check Z_MIN_PROBE for ALL movement
606
     if (G38_move) {
606
     if (G38_move) {
607
       if (TEST_ENDSTOP(_ENDSTOP(Z, MIN_PROBE))) {
607
       if (TEST_ENDSTOP(_ENDSTOP(Z, MIN_PROBE))) {
608
-        if      (stepper.axis_is_moving(_AXIS(X))) { _ENDSTOP_HIT(X, MIN); planner.endstop_triggered(_AXIS(X)); }
609
-        else if (stepper.axis_is_moving(_AXIS(Y))) { _ENDSTOP_HIT(Y, MIN); planner.endstop_triggered(_AXIS(Y)); }
610
-        else if (stepper.axis_is_moving(_AXIS(Z))) { _ENDSTOP_HIT(Z, MIN); planner.endstop_triggered(_AXIS(Z)); }
608
+        if      (stepper.axis_is_moving(X_AXIS)) { _ENDSTOP_HIT(X, MIN); planner.endstop_triggered(X_AXIS); }
609
+        else if (stepper.axis_is_moving(Y_AXIS)) { _ENDSTOP_HIT(Y, MIN); planner.endstop_triggered(Y_AXIS); }
610
+        else if (stepper.axis_is_moving(Z_AXIS)) { _ENDSTOP_HIT(Z, MIN); planner.endstop_triggered(Z_AXIS); }
611
         G38_endstop_hit = true;
611
         G38_endstop_hit = true;
612
       }
612
       }
613
     }
613
     }

+ 10
- 10
Marlin/src/module/stepper.cpp Прегледај датотеку

1589
         #endif
1589
         #endif
1590
         #define X_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && D_(1) X_CMP D_(2)) )
1590
         #define X_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && D_(1) X_CMP D_(2)) )
1591
       #else
1591
       #else
1592
-        #define X_MOVE_TEST !!current_block->steps[X_AXIS]
1592
+        #define X_MOVE_TEST !!current_block->steps[A_AXIS]
1593
       #endif
1593
       #endif
1594
 
1594
 
1595
       #if CORE_IS_XY || CORE_IS_YZ
1595
       #if CORE_IS_XY || CORE_IS_YZ
1607
         #endif
1607
         #endif
1608
         #define Y_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && D_(1) Y_CMP D_(2)) )
1608
         #define Y_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && D_(1) Y_CMP D_(2)) )
1609
       #else
1609
       #else
1610
-        #define Y_MOVE_TEST !!current_block->steps[Y_AXIS]
1610
+        #define Y_MOVE_TEST !!current_block->steps[B_AXIS]
1611
       #endif
1611
       #endif
1612
 
1612
 
1613
       #if CORE_IS_XZ || CORE_IS_YZ
1613
       #if CORE_IS_XZ || CORE_IS_YZ
1625
         #endif
1625
         #endif
1626
         #define Z_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && D_(1) Z_CMP D_(2)) )
1626
         #define Z_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && D_(1) Z_CMP D_(2)) )
1627
       #else
1627
       #else
1628
-        #define Z_MOVE_TEST !!current_block->steps[Z_AXIS]
1628
+        #define Z_MOVE_TEST !!current_block->steps[C_AXIS]
1629
       #endif
1629
       #endif
1630
 
1630
 
1631
-      SET_BIT(axis_did_move, X_AXIS, X_MOVE_TEST);
1632
-      SET_BIT(axis_did_move, Y_AXIS, Y_MOVE_TEST);
1633
-      SET_BIT(axis_did_move, Z_AXIS, Z_MOVE_TEST);
1634
-      SET_BIT(axis_did_move, E_AXIS, !!current_block->steps[E_AXIS]);
1635
-      SET_BIT(axis_did_move, X_HEAD, !!current_block->steps[X_HEAD]);
1636
-      SET_BIT(axis_did_move, Y_HEAD, !!current_block->steps[Y_HEAD]);
1637
-      SET_BIT(axis_did_move, Z_HEAD, !!current_block->steps[Z_HEAD]);
1631
+      SET_BIT_TO(axis_did_move, X_AXIS, X_MOVE_TEST);
1632
+      SET_BIT_TO(axis_did_move, Y_AXIS, Y_MOVE_TEST);
1633
+      SET_BIT_TO(axis_did_move, Z_AXIS, Z_MOVE_TEST);
1634
+      //SET_BIT_TO(axis_did_move, E_AXIS, !!current_block->steps[E_AXIS]);
1635
+      //SET_BIT_TO(axis_did_move, X_HEAD, !!current_block->steps[A_AXIS]);
1636
+      //SET_BIT_TO(axis_did_move, Y_HEAD, !!current_block->steps[B_AXIS]);
1637
+      //SET_BIT_TO(axis_did_move, Z_HEAD, !!current_block->steps[C_AXIS]);
1638
 
1638
 
1639
       // Initialize the trapezoid generator from the current block.
1639
       // Initialize the trapezoid generator from the current block.
1640
       #if ENABLED(LIN_ADVANCE)
1640
       #if ENABLED(LIN_ADVANCE)

Loading…
Откажи
Сачувај