Merge pull request #6548 from thinkyhead/rc_fix_dual_z_endstops

Fix Dual-Z endstop conditional test
This commit is contained in:
Scott Lahteine 2017-05-02 16:00:49 -05:00 committed by GitHub
commit 46a5cab6fb
4 changed files with 29 additions and 13 deletions

View file

@ -413,9 +413,10 @@
#endif
#endif
#define IS_Z2_OR_PROBE(P) ( (PIN_EXISTS(Z2_MIN) && (P) == Z2_MIN_PIN) \
|| (PIN_EXISTS(Z2_MAX) && (P) == Z2_MAX_PIN) \
|| (PIN_EXISTS(Z_MIN_PROBE) && (P) == Z_MIN_PROBE_PIN))
// Is an endstop plug used for the Z2 endstop or the bed probe?
#define IS_Z2_OR_PROBE(A,M) ( \
(ENABLED(Z_DUAL_ENDSTOPS) && Z2_USE_ENDSTOP == _##A##M##_) \
|| (ENABLED(Z_MIN_PROBE_ENDSTOP) && Z_MIN_PROBE_PIN == A##_##M##_PIN ) )
/**
* Set ENDSTOPPULLUPS for active endstop switches
@ -505,12 +506,12 @@
#define HAS_SOLENOID_4 (PIN_EXISTS(SOL4))
// Endstops and bed probe
#define HAS_X_MIN (PIN_EXISTS(X_MIN) && !IS_Z2_OR_PROBE(X_MIN_PIN))
#define HAS_X_MAX (PIN_EXISTS(X_MAX) && !IS_Z2_OR_PROBE(X_MAX_PIN))
#define HAS_Y_MIN (PIN_EXISTS(Y_MIN) && !IS_Z2_OR_PROBE(Y_MIN_PIN))
#define HAS_Y_MAX (PIN_EXISTS(Y_MAX) && !IS_Z2_OR_PROBE(Y_MAX_PIN))
#define HAS_Z_MIN (PIN_EXISTS(Z_MIN) && !IS_Z2_OR_PROBE(Z_MIN_PIN))
#define HAS_Z_MAX (PIN_EXISTS(Z_MAX) && !IS_Z2_OR_PROBE(Z_MAX_PIN))
#define HAS_X_MIN (PIN_EXISTS(X_MIN) && !IS_Z2_OR_PROBE(X,MIN))
#define HAS_X_MAX (PIN_EXISTS(X_MAX) && !IS_Z2_OR_PROBE(X,MAX))
#define HAS_Y_MIN (PIN_EXISTS(Y_MIN) && !IS_Z2_OR_PROBE(Y,MIN))
#define HAS_Y_MAX (PIN_EXISTS(Y_MAX) && !IS_Z2_OR_PROBE(Y,MAX))
#define HAS_Z_MIN (PIN_EXISTS(Z_MIN) && !IS_Z2_OR_PROBE(Z,MIN))
#define HAS_Z_MAX (PIN_EXISTS(Z_MAX) && !IS_Z2_OR_PROBE(Z,MAX))
#define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
#define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
#define HAS_Z_MIN_PROBE_PIN (PIN_EXISTS(Z_MIN_PROBE))

View file

@ -77,7 +77,7 @@
#elif defined(DISABLE_MAX_ENDSTOPS) || defined(DISABLE_MIN_ENDSTOPS)
#error "DISABLE_MAX_ENDSTOPS and DISABLE_MIN_ENDSTOPS deprecated. Use individual USE_*_PLUG options instead."
#elif ENABLED(Z_DUAL_ENDSTOPS) && !defined(Z2_USE_ENDSTOP)
#error "Z_DUAL_ENDSTOPS settings are simplified. Just set Z2_USE_ENDSTOP to the endstop you want to repurpose for Z2"
#error "Z_DUAL_ENDSTOPS settings are simplified. Just set Z2_USE_ENDSTOP to the endstop you want to repurpose for Z2."
#elif defined(LANGUAGE_INCLUDE)
#error "LANGUAGE_INCLUDE has been replaced by LCD_LANGUAGE. Please update your configuration."
#elif defined(EXTRUDER_OFFSET_X) || defined(EXTRUDER_OFFSET_Y)
@ -916,6 +916,8 @@ static_assert(1 >= 0
#elif ENABLED(Z_DUAL_ENDSTOPS)
#if !Z2_USE_ENDSTOP
#error "You must set Z2_USE_ENDSTOP with Z_DUAL_ENDSTOPS."
#elif Z2_MAX_PIN == 0 && Z2_MIN_PIN == 0
#error "Z2_USE_ENDSTOP has been assigned to a nonexistent endstop!"
#elif ENABLED(DELTA)
#error "Z_DUAL_ENDSTOPS is not compatible with DELTA."
#endif

View file

@ -157,11 +157,15 @@ void Endstops::report_state() {
if (TEST(endstop_hit_bits, A ##_MIN) || TEST(endstop_hit_bits, A ##_MAX)) \
_ENDSTOP_HIT_ECHO(A,C)
#define ENDSTOP_HIT_TEST_X() _ENDSTOP_HIT_TEST(X,'X')
#define ENDSTOP_HIT_TEST_Y() _ENDSTOP_HIT_TEST(Y,'Y')
#define ENDSTOP_HIT_TEST_Z() _ENDSTOP_HIT_TEST(Z,'Z')
SERIAL_ECHO_START;
SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
_ENDSTOP_HIT_TEST(X, 'X');
_ENDSTOP_HIT_TEST(Y, 'Y');
_ENDSTOP_HIT_TEST(Z, 'Z');
ENDSTOP_HIT_TEST_X();
ENDSTOP_HIT_TEST_Y();
ENDSTOP_HIT_TEST_Z();
#if ENABLED(Z_MIN_PROBE_ENDSTOP)
#define P_AXIS Z_AXIS

View file

@ -461,6 +461,9 @@
#define X2_STEP_PIN _EPIN(E_STEPPERS, STEP)
#define X2_DIR_PIN _EPIN(E_STEPPERS, DIR)
#define X2_ENABLE_PIN _EPIN(E_STEPPERS, ENABLE)
#if X2_ENABLE_PIN == 0
#error "No E stepper plug left for X2!"
#endif
#endif
#undef _X2_PINS
#define _X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN,
@ -475,6 +478,9 @@
#define Y2_STEP_PIN _EPIN(Y2_E_INDEX, STEP)
#define Y2_DIR_PIN _EPIN(Y2_E_INDEX, DIR)
#define Y2_ENABLE_PIN _EPIN(Y2_E_INDEX, ENABLE)
#if Y2_ENABLE_PIN == 0
#error "No E stepper plug left for Y2!"
#endif
#endif
#undef _Y2_PINS
#define _Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN,
@ -489,6 +495,9 @@
#define Z2_STEP_PIN _EPIN(Z2_E_INDEX, STEP)
#define Z2_DIR_PIN _EPIN(Z2_E_INDEX, DIR)
#define Z2_ENABLE_PIN _EPIN(Z2_E_INDEX, ENABLE)
#if Z2_ENABLE_PIN == 0
#error "No E stepper plug left for Z2!"
#endif
#endif
#undef _Z2_PINS
#define _Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN,