Patches for core motion tests

This commit is contained in:
Scott Lahteine 2018-05-24 00:04:47 -05:00
parent 5f8591528e
commit 9644d56b42
4 changed files with 20 additions and 21 deletions

View file

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

View file

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

View file

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

View file

@ -1589,7 +1589,7 @@ uint32_t Stepper::stepper_block_phase_isr() {
#endif
#define X_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && D_(1) X_CMP D_(2)) )
#else
#define X_MOVE_TEST !!current_block->steps[X_AXIS]
#define X_MOVE_TEST !!current_block->steps[A_AXIS]
#endif
#if CORE_IS_XY || CORE_IS_YZ
@ -1607,7 +1607,7 @@ uint32_t Stepper::stepper_block_phase_isr() {
#endif
#define Y_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && D_(1) Y_CMP D_(2)) )
#else
#define Y_MOVE_TEST !!current_block->steps[Y_AXIS]
#define Y_MOVE_TEST !!current_block->steps[B_AXIS]
#endif
#if CORE_IS_XZ || CORE_IS_YZ
@ -1625,16 +1625,16 @@ uint32_t Stepper::stepper_block_phase_isr() {
#endif
#define Z_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && D_(1) Z_CMP D_(2)) )
#else
#define Z_MOVE_TEST !!current_block->steps[Z_AXIS]
#define Z_MOVE_TEST !!current_block->steps[C_AXIS]
#endif
SET_BIT(axis_did_move, X_AXIS, X_MOVE_TEST);
SET_BIT(axis_did_move, Y_AXIS, Y_MOVE_TEST);
SET_BIT(axis_did_move, Z_AXIS, Z_MOVE_TEST);
SET_BIT(axis_did_move, E_AXIS, !!current_block->steps[E_AXIS]);
SET_BIT(axis_did_move, X_HEAD, !!current_block->steps[X_HEAD]);
SET_BIT(axis_did_move, Y_HEAD, !!current_block->steps[Y_HEAD]);
SET_BIT(axis_did_move, Z_HEAD, !!current_block->steps[Z_HEAD]);
SET_BIT_TO(axis_did_move, X_AXIS, X_MOVE_TEST);
SET_BIT_TO(axis_did_move, Y_AXIS, Y_MOVE_TEST);
SET_BIT_TO(axis_did_move, Z_AXIS, Z_MOVE_TEST);
//SET_BIT_TO(axis_did_move, E_AXIS, !!current_block->steps[E_AXIS]);
//SET_BIT_TO(axis_did_move, X_HEAD, !!current_block->steps[A_AXIS]);
//SET_BIT_TO(axis_did_move, Y_HEAD, !!current_block->steps[B_AXIS]);
//SET_BIT_TO(axis_did_move, Z_HEAD, !!current_block->steps[C_AXIS]);
// Initialize the trapezoid generator from the current block.
#if ENABLED(LIN_ADVANCE)