|
|
@ -42,7 +42,7 @@ Endstops endstops;
|
|
|
|
bool Endstops::enabled, Endstops::enabled_globally; // Initialized by settings.load()
|
|
|
|
bool Endstops::enabled, Endstops::enabled_globally; // Initialized by settings.load()
|
|
|
|
volatile char Endstops::endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT value
|
|
|
|
volatile char Endstops::endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT value
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
|
|
|
#if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
|
|
|
|
uint16_t
|
|
|
|
uint16_t
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
byte
|
|
|
|
byte
|
|
|
@ -54,8 +54,14 @@ volatile char Endstops::endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_P
|
|
|
|
volatile bool Endstops::z_probe_enabled = false;
|
|
|
|
volatile bool Endstops::z_probe_enabled = false;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(X_DUAL_ENDSTOPS)
|
|
|
|
|
|
|
|
float Endstops::x_endstop_adj; // Initialized by settings.load()
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Y_DUAL_ENDSTOPS)
|
|
|
|
|
|
|
|
float Endstops::y_endstop_adj; // Initialized by settings.load()
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
|
|
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
|
|
|
float Endstops::z_endstop_adj;
|
|
|
|
float Endstops::z_endstop_adj; // Initialized by settings.load()
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -72,6 +78,14 @@ void Endstops::init() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_X2_MIN
|
|
|
|
|
|
|
|
#if ENABLED(ENDSTOPPULLUP_XMIN)
|
|
|
|
|
|
|
|
SET_INPUT_PULLUP(X2_MIN_PIN);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
SET_INPUT(X2_MIN_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_Y_MIN
|
|
|
|
#if HAS_Y_MIN
|
|
|
|
#if ENABLED(ENDSTOPPULLUP_YMIN)
|
|
|
|
#if ENABLED(ENDSTOPPULLUP_YMIN)
|
|
|
|
SET_INPUT_PULLUP(Y_MIN_PIN);
|
|
|
|
SET_INPUT_PULLUP(Y_MIN_PIN);
|
|
|
@ -80,6 +94,14 @@ void Endstops::init() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_Y2_MIN
|
|
|
|
|
|
|
|
#if ENABLED(ENDSTOPPULLUP_YMIN)
|
|
|
|
|
|
|
|
SET_INPUT_PULLUP(Y2_MIN_PIN);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
SET_INPUT(Y2_MIN_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_Z_MIN
|
|
|
|
#if HAS_Z_MIN
|
|
|
|
#if ENABLED(ENDSTOPPULLUP_ZMIN)
|
|
|
|
#if ENABLED(ENDSTOPPULLUP_ZMIN)
|
|
|
|
SET_INPUT_PULLUP(Z_MIN_PIN);
|
|
|
|
SET_INPUT_PULLUP(Z_MIN_PIN);
|
|
|
@ -104,6 +126,14 @@ void Endstops::init() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_X2_MAX
|
|
|
|
|
|
|
|
#if ENABLED(ENDSTOPPULLUP_XMAX)
|
|
|
|
|
|
|
|
SET_INPUT_PULLUP(X2_MAX_PIN);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
SET_INPUT(X2_MAX_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_Y_MAX
|
|
|
|
#if HAS_Y_MAX
|
|
|
|
#if ENABLED(ENDSTOPPULLUP_YMAX)
|
|
|
|
#if ENABLED(ENDSTOPPULLUP_YMAX)
|
|
|
|
SET_INPUT_PULLUP(Y_MAX_PIN);
|
|
|
|
SET_INPUT_PULLUP(Y_MAX_PIN);
|
|
|
@ -112,6 +142,14 @@ void Endstops::init() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_Y2_MAX
|
|
|
|
|
|
|
|
#if ENABLED(ENDSTOPPULLUP_YMAX)
|
|
|
|
|
|
|
|
SET_INPUT_PULLUP(Y2_MAX_PIN);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
SET_INPUT(Y2_MAX_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_Z_MAX
|
|
|
|
#if HAS_Z_MAX
|
|
|
|
#if ENABLED(ENDSTOPPULLUP_ZMAX)
|
|
|
|
#if ENABLED(ENDSTOPPULLUP_ZMAX)
|
|
|
|
SET_INPUT_PULLUP(Z_MAX_PIN);
|
|
|
|
SET_INPUT_PULLUP(Z_MAX_PIN);
|
|
|
@ -190,37 +228,45 @@ void Endstops::report_state() {
|
|
|
|
|
|
|
|
|
|
|
|
void Endstops::M119() {
|
|
|
|
void Endstops::M119() {
|
|
|
|
SERIAL_PROTOCOLLNPGM(MSG_M119_REPORT);
|
|
|
|
SERIAL_PROTOCOLLNPGM(MSG_M119_REPORT);
|
|
|
|
|
|
|
|
#define ES_REPORT(AXIS) do{ \
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_##AXIS); \
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLN(((READ(AXIS##_PIN)^AXIS##_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN)); \
|
|
|
|
|
|
|
|
}while(0)
|
|
|
|
#if HAS_X_MIN
|
|
|
|
#if HAS_X_MIN
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_X_MIN);
|
|
|
|
ES_REPORT(X_MIN);
|
|
|
|
SERIAL_PROTOCOLLN(((READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_X2_MIN
|
|
|
|
|
|
|
|
ES_REPORT(X2_MIN);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if HAS_X_MAX
|
|
|
|
#if HAS_X_MAX
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_X_MAX);
|
|
|
|
ES_REPORT(X_MAX);
|
|
|
|
SERIAL_PROTOCOLLN(((READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_X2_MAX
|
|
|
|
|
|
|
|
ES_REPORT(X2_MAX);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if HAS_Y_MIN
|
|
|
|
#if HAS_Y_MIN
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_Y_MIN);
|
|
|
|
ES_REPORT(Y_MIN);
|
|
|
|
SERIAL_PROTOCOLLN(((READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_Y2_MIN
|
|
|
|
|
|
|
|
ES_REPORT(Y2_MIN);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if HAS_Y_MAX
|
|
|
|
#if HAS_Y_MAX
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_Y_MAX);
|
|
|
|
ES_REPORT(Y_MAX);
|
|
|
|
SERIAL_PROTOCOLLN(((READ(Y_MAX_PIN)^Y_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_Y2_MAX
|
|
|
|
|
|
|
|
ES_REPORT(Y2_MAX);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if HAS_Z_MIN
|
|
|
|
#if HAS_Z_MIN
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_Z_MIN);
|
|
|
|
ES_REPORT(Z_MIN);
|
|
|
|
SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if HAS_Z2_MIN
|
|
|
|
#if HAS_Z2_MIN
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_Z2_MIN);
|
|
|
|
ES_REPORT(Z2_MIN);
|
|
|
|
SERIAL_PROTOCOLLN(((READ(Z2_MIN_PIN)^Z2_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if HAS_Z_MAX
|
|
|
|
#if HAS_Z_MAX
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_Z_MAX);
|
|
|
|
ES_REPORT(Z_MAX);
|
|
|
|
SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if HAS_Z2_MAX
|
|
|
|
#if HAS_Z2_MAX
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_Z2_MAX);
|
|
|
|
ES_REPORT(Z2_MAX);
|
|
|
|
SERIAL_PROTOCOLLN(((READ(Z2_MAX_PIN)^Z2_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if ENABLED(Z_MIN_PROBE_ENDSTOP)
|
|
|
|
#if ENABLED(Z_MIN_PROBE_ENDSTOP)
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_Z_PROBE);
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_Z_PROBE);
|
|
|
@ -232,18 +278,35 @@ void Endstops::M119() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
} // Endstops::M119
|
|
|
|
} // Endstops::M119
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(X_DUAL_ENDSTOPS)
|
|
|
|
|
|
|
|
void Endstops::test_dual_x_endstops(const EndstopEnum es1, const EndstopEnum es2) {
|
|
|
|
|
|
|
|
const byte x_test = TEST_ENDSTOP(es1) | (TEST_ENDSTOP(es2) << 1); // bit 0 for X, bit 1 for X2
|
|
|
|
|
|
|
|
if (x_test && stepper.current_block->steps[X_AXIS] > 0) {
|
|
|
|
|
|
|
|
SBI(endstop_hit_bits, X_MIN);
|
|
|
|
|
|
|
|
if (!stepper.performing_homing || (x_test == 0x3)) //if not performing home or if both endstops were trigged during homing...
|
|
|
|
|
|
|
|
stepper.kill_current_block();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Y_DUAL_ENDSTOPS)
|
|
|
|
|
|
|
|
void Endstops::test_dual_y_endstops(const EndstopEnum es1, const EndstopEnum es2) {
|
|
|
|
|
|
|
|
const byte y_test = TEST_ENDSTOP(es1) | (TEST_ENDSTOP(es2) << 1); // bit 0 for Y, bit 1 for Y2
|
|
|
|
|
|
|
|
if (y_test && stepper.current_block->steps[Y_AXIS] > 0) {
|
|
|
|
|
|
|
|
SBI(endstop_hit_bits, Y_MIN);
|
|
|
|
|
|
|
|
if (!stepper.performing_homing || (y_test == 0x3)) //if not performing home or if both endstops were trigged during homing...
|
|
|
|
|
|
|
|
stepper.kill_current_block();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
|
|
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
|
|
|
|
|
|
|
|
|
|
|
// Pass the result of the endstop test
|
|
|
|
|
|
|
|
void Endstops::test_dual_z_endstops(const EndstopEnum es1, const EndstopEnum es2) {
|
|
|
|
void Endstops::test_dual_z_endstops(const EndstopEnum es1, const EndstopEnum es2) {
|
|
|
|
byte z_test = TEST_ENDSTOP(es1) | (TEST_ENDSTOP(es2) << 1); // bit 0 for Z, bit 1 for Z2
|
|
|
|
const byte z_test = TEST_ENDSTOP(es1) | (TEST_ENDSTOP(es2) << 1); // bit 0 for Z, bit 1 for Z2
|
|
|
|
if (z_test && stepper.current_block->steps[Z_AXIS] > 0) {
|
|
|
|
if (z_test && stepper.current_block->steps[Z_AXIS] > 0) {
|
|
|
|
SBI(endstop_hit_bits, Z_MIN);
|
|
|
|
SBI(endstop_hit_bits, Z_MIN);
|
|
|
|
if (!stepper.performing_homing || (z_test == 0x3)) //if not performing home or if both endstops were trigged during homing...
|
|
|
|
if (!stepper.performing_homing || (z_test == 0x3)) //if not performing home or if both endstops were trigged during homing...
|
|
|
|
stepper.kill_current_block();
|
|
|
|
stepper.kill_current_block();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// Check endstops - Called from ISR!
|
|
|
|
// Check endstops - Called from ISR!
|
|
|
@ -364,16 +427,35 @@ void Endstops::update() {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
if (X_MOVE_TEST) {
|
|
|
|
if (X_MOVE_TEST) {
|
|
|
|
if (stepper.motor_direction(X_AXIS_HEAD)) {
|
|
|
|
if (stepper.motor_direction(X_AXIS_HEAD)) { // -direction
|
|
|
|
if (X_MIN_TEST) { // -direction
|
|
|
|
|
|
|
|
#if HAS_X_MIN
|
|
|
|
#if HAS_X_MIN
|
|
|
|
UPDATE_ENDSTOP(X, MIN);
|
|
|
|
#if ENABLED(X_DUAL_ENDSTOPS)
|
|
|
|
|
|
|
|
UPDATE_ENDSTOP_BIT(X, MIN);
|
|
|
|
|
|
|
|
#if HAS_X2_MIN
|
|
|
|
|
|
|
|
UPDATE_ENDSTOP_BIT(X2, MIN);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
COPY_BIT(current_endstop_bits, X_MIN, X2_MIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
test_dual_x_endstops(X_MIN, X2_MIN);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
if (X_MIN_TEST) UPDATE_ENDSTOP(X, MIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else { // +direction
|
|
|
|
else if (X_MAX_TEST) { // +direction
|
|
|
|
|
|
|
|
#if HAS_X_MAX
|
|
|
|
#if HAS_X_MAX
|
|
|
|
UPDATE_ENDSTOP(X, MAX);
|
|
|
|
#if ENABLED(X_DUAL_ENDSTOPS)
|
|
|
|
|
|
|
|
UPDATE_ENDSTOP_BIT(X, MAX);
|
|
|
|
|
|
|
|
#if HAS_X2_MAX
|
|
|
|
|
|
|
|
UPDATE_ENDSTOP_BIT(X2, MAX);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
COPY_BIT(current_endstop_bits, X_MAX, X2_MAX);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
test_dual_x_endstops(X_MAX, X2_MAX);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
if (X_MIN_TEST) UPDATE_ENDSTOP(X, MAX);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -381,13 +463,33 @@ void Endstops::update() {
|
|
|
|
if (Y_MOVE_TEST) {
|
|
|
|
if (Y_MOVE_TEST) {
|
|
|
|
if (stepper.motor_direction(Y_AXIS_HEAD)) { // -direction
|
|
|
|
if (stepper.motor_direction(Y_AXIS_HEAD)) { // -direction
|
|
|
|
#if HAS_Y_MIN
|
|
|
|
#if HAS_Y_MIN
|
|
|
|
|
|
|
|
#if ENABLED(Y_DUAL_ENDSTOPS)
|
|
|
|
|
|
|
|
UPDATE_ENDSTOP_BIT(Y, MIN);
|
|
|
|
|
|
|
|
#if HAS_Y2_MIN
|
|
|
|
|
|
|
|
UPDATE_ENDSTOP_BIT(Y2, MIN);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
COPY_BIT(current_endstop_bits, Y_MIN, Y2_MIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
test_dual_y_endstops(Y_MIN, Y2_MIN);
|
|
|
|
|
|
|
|
#else
|
|
|
|
UPDATE_ENDSTOP(Y, MIN);
|
|
|
|
UPDATE_ENDSTOP(Y, MIN);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else { // +direction
|
|
|
|
else { // +direction
|
|
|
|
#if HAS_Y_MAX
|
|
|
|
#if HAS_Y_MAX
|
|
|
|
|
|
|
|
#if ENABLED(Y_DUAL_ENDSTOPS)
|
|
|
|
|
|
|
|
UPDATE_ENDSTOP_BIT(Y, MAX);
|
|
|
|
|
|
|
|
#if HAS_Y2_MAX
|
|
|
|
|
|
|
|
UPDATE_ENDSTOP_BIT(Y2, MAX);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
COPY_BIT(current_endstop_bits, Y_MAX, Y2_MAX);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
test_dual_y_endstops(Y_MAX, Y2_MAX);
|
|
|
|
|
|
|
|
#else
|
|
|
|
UPDATE_ENDSTOP(Y, MAX);
|
|
|
|
UPDATE_ENDSTOP(Y, MAX);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -395,27 +497,21 @@ void Endstops::update() {
|
|
|
|
if (stepper.motor_direction(Z_AXIS_HEAD)) { // Z -direction. Gantry down, bed up.
|
|
|
|
if (stepper.motor_direction(Z_AXIS_HEAD)) { // Z -direction. Gantry down, bed up.
|
|
|
|
#if HAS_Z_MIN
|
|
|
|
#if HAS_Z_MIN
|
|
|
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
|
|
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE_ENDSTOP_BIT(Z, MIN);
|
|
|
|
UPDATE_ENDSTOP_BIT(Z, MIN);
|
|
|
|
#if HAS_Z2_MIN
|
|
|
|
#if HAS_Z2_MIN
|
|
|
|
UPDATE_ENDSTOP_BIT(Z2, MIN);
|
|
|
|
UPDATE_ENDSTOP_BIT(Z2, MIN);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
COPY_BIT(current_endstop_bits, Z_MIN, Z2_MIN);
|
|
|
|
COPY_BIT(current_endstop_bits, Z_MIN, Z2_MIN);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
test_dual_z_endstops(Z_MIN, Z2_MIN);
|
|
|
|
test_dual_z_endstops(Z_MIN, Z2_MIN);
|
|
|
|
|
|
|
|
#else
|
|
|
|
#else // !Z_DUAL_ENDSTOPS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
|
|
|
|
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
|
|
|
|
if (z_probe_enabled) UPDATE_ENDSTOP(Z, MIN);
|
|
|
|
if (z_probe_enabled) UPDATE_ENDSTOP(Z, MIN);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
UPDATE_ENDSTOP(Z, MIN);
|
|
|
|
UPDATE_ENDSTOP(Z, MIN);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif // !Z_DUAL_ENDSTOPS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif // HAS_Z_MIN
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// When closing the gap check the enabled probe
|
|
|
|
// When closing the gap check the enabled probe
|
|
|
|
#if ENABLED(Z_MIN_PROBE_ENDSTOP)
|
|
|
|
#if ENABLED(Z_MIN_PROBE_ENDSTOP)
|
|
|
@ -427,27 +523,21 @@ void Endstops::update() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else { // Z +direction. Gantry up, bed down.
|
|
|
|
else { // Z +direction. Gantry up, bed down.
|
|
|
|
#if HAS_Z_MAX
|
|
|
|
#if HAS_Z_MAX
|
|
|
|
|
|
|
|
|
|
|
|
// Check both Z dual endstops
|
|
|
|
// Check both Z dual endstops
|
|
|
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
|
|
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE_ENDSTOP_BIT(Z, MAX);
|
|
|
|
UPDATE_ENDSTOP_BIT(Z, MAX);
|
|
|
|
#if HAS_Z2_MAX
|
|
|
|
#if HAS_Z2_MAX
|
|
|
|
UPDATE_ENDSTOP_BIT(Z2, MAX);
|
|
|
|
UPDATE_ENDSTOP_BIT(Z2, MAX);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
COPY_BIT(current_endstop_bits, Z_MAX, Z2_MAX);
|
|
|
|
COPY_BIT(current_endstop_bits, Z_MAX, Z2_MAX);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
test_dual_z_endstops(Z_MAX, Z2_MAX);
|
|
|
|
test_dual_z_endstops(Z_MAX, Z2_MAX);
|
|
|
|
|
|
|
|
|
|
|
|
// If this pin is not hijacked for the bed probe
|
|
|
|
// If this pin is not hijacked for the bed probe
|
|
|
|
// then it belongs to the Z endstop
|
|
|
|
// then it belongs to the Z endstop
|
|
|
|
#elif DISABLED(Z_MIN_PROBE_ENDSTOP) || Z_MAX_PIN != Z_MIN_PROBE_PIN
|
|
|
|
#elif DISABLED(Z_MIN_PROBE_ENDSTOP) || Z_MAX_PIN != Z_MIN_PROBE_PIN
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE_ENDSTOP(Z, MAX);
|
|
|
|
UPDATE_ENDSTOP(Z, MAX);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif // !Z_MIN_PROBE_PIN...
|
|
|
|
#endif
|
|
|
|
#endif // Z_MAX_PIN
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -496,6 +586,18 @@ void Endstops::update() {
|
|
|
|
#if HAS_Z_MIN_PROBE_PIN
|
|
|
|
#if HAS_Z_MIN_PROBE_PIN
|
|
|
|
if (READ(Z_MIN_PROBE_PIN)) SBI(current_endstop_bits_local, Z_MIN_PROBE);
|
|
|
|
if (READ(Z_MIN_PROBE_PIN)) SBI(current_endstop_bits_local, Z_MIN_PROBE);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_X2_MIN
|
|
|
|
|
|
|
|
if (READ(X2_MIN_PIN)) SBI(current_endstop_bits_local, X2_MIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_X2_MAX
|
|
|
|
|
|
|
|
if (READ(X2_MAX_PIN)) SBI(current_endstop_bits_local, X2_MAX);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_Y2_MIN
|
|
|
|
|
|
|
|
if (READ(Y2_MIN_PIN)) SBI(current_endstop_bits_local, Y2_MIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_Y2_MAX
|
|
|
|
|
|
|
|
if (READ(Y2_MAX_PIN)) SBI(current_endstop_bits_local, Y2_MAX);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#if HAS_Z2_MIN
|
|
|
|
#if HAS_Z2_MIN
|
|
|
|
if (READ(Z2_MIN_PIN)) SBI(current_endstop_bits_local, Z2_MIN);
|
|
|
|
if (READ(Z2_MIN_PIN)) SBI(current_endstop_bits_local, Z2_MIN);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -527,6 +629,18 @@ void Endstops::update() {
|
|
|
|
#if HAS_Z_MIN_PROBE_PIN
|
|
|
|
#if HAS_Z_MIN_PROBE_PIN
|
|
|
|
if (TEST(endstop_change, Z_MIN_PROBE)) SERIAL_PROTOCOLPAIR(" PROBE:", !!TEST(current_endstop_bits_local, Z_MIN_PROBE));
|
|
|
|
if (TEST(endstop_change, Z_MIN_PROBE)) SERIAL_PROTOCOLPAIR(" PROBE:", !!TEST(current_endstop_bits_local, Z_MIN_PROBE));
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_X2_MIN
|
|
|
|
|
|
|
|
if (TEST(endstop_change, X2_MIN)) SERIAL_PROTOCOLPAIR(" X2_MIN:", !!TEST(current_endstop_bits_local, X2_MIN));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_X2_MAX
|
|
|
|
|
|
|
|
if (TEST(endstop_change, X2_MAX)) SERIAL_PROTOCOLPAIR(" X2_MAX:", !!TEST(current_endstop_bits_local, X2_MAX));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_Y2_MIN
|
|
|
|
|
|
|
|
if (TEST(endstop_change, Y2_MIN)) SERIAL_PROTOCOLPAIR(" Y2_MIN:", !!TEST(current_endstop_bits_local, Y2_MIN));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_Y2_MAX
|
|
|
|
|
|
|
|
if (TEST(endstop_change, Y2_MAX)) SERIAL_PROTOCOLPAIR(" Y2_MAX:", !!TEST(current_endstop_bits_local, Y2_MAX));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#if HAS_Z2_MIN
|
|
|
|
#if HAS_Z2_MIN
|
|
|
|
if (TEST(endstop_change, Z2_MIN)) SERIAL_PROTOCOLPAIR(" Z2_MIN:", !!TEST(current_endstop_bits_local, Z2_MIN));
|
|
|
|
if (TEST(endstop_change, Z2_MIN)) SERIAL_PROTOCOLPAIR(" Z2_MIN:", !!TEST(current_endstop_bits_local, Z2_MIN));
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|