Merge pull request #4562 from thinkyhead/rc_fix_z_dual_endstops

Fix Z_DUAL_ENDSTOPS with Z MIN Homing
This commit is contained in:
Scott Lahteine 2016-08-07 19:23:09 -07:00 committed by GitHub
commit 67c4acf750
3 changed files with 87 additions and 52 deletions

View File

@ -34,33 +34,6 @@
#define EMERGENCY_PARSER_CAPABILITIES ""
#endif
/**
* Set ENDSTOPPULLUPS for unused endstop switches
*/
#if ENABLED(ENDSTOPPULLUPS)
#if ENABLED(USE_XMAX_PLUG)
#define ENDSTOPPULLUP_XMAX
#endif
#if ENABLED(USE_YMAX_PLUG)
#define ENDSTOPPULLUP_YMAX
#endif
#if ENABLED(USE_ZMAX_PLUG)
#define ENDSTOPPULLUP_ZMAX
#endif
#if ENABLED(USE_XMIN_PLUG)
#define ENDSTOPPULLUP_XMIN
#endif
#if ENABLED(USE_YMIN_PLUG)
#define ENDSTOPPULLUP_YMIN
#endif
#if ENABLED(USE_ZMIN_PLUG)
#define ENDSTOPPULLUP_ZMIN
#endif
#if DISABLED(DISABLE_Z_MIN_PROBE_ENDSTOP)
#define ENDSTOPPULLUP_ZMIN_PROBE
#endif
#endif
/**
* Axis lengths
*/
@ -363,31 +336,89 @@
#define _YMAX_ 201
#define _ZMAX_ 301
#if Z2_USE_ENDSTOP == _XMAX_
#define Z2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
#define Z2_MAX_PIN X_MAX_PIN
#undef USE_XMAX_PLUG
#define USE_XMAX_PLUG
#elif Z2_USE_ENDSTOP == _YMAX_
#define Z2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
#define Z2_MAX_PIN Y_MAX_PIN
#undef USE_YMAX_PLUG
#define USE_YMAX_PLUG
#elif Z2_USE_ENDSTOP == _ZMAX_
#define Z2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
#define Z2_MAX_PIN Z_MAX_PIN
#undef USE_ZMAX_PLUG
#define USE_ZMAX_PLUG
#elif Z2_USE_ENDSTOP == _XMIN_
#define Z2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
#define Z2_MAX_PIN X_MIN_PIN
#undef USE_XMIN_PLUG
#define USE_XMIN_PLUG
#elif Z2_USE_ENDSTOP == _YMIN_
#define Z2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
#define Z2_MAX_PIN Y_MIN_PIN
#undef USE_YMIN_PLUG
#define USE_YMIN_PLUG
#elif Z2_USE_ENDSTOP == _ZMIN_
#define Z2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
#define Z2_MAX_PIN Z_MIN_PIN
#undef USE_ZMIN_PLUG
#define USE_ZMIN_PLUG
#endif
#if Z_HOME_DIR > 0
#if Z2_USE_ENDSTOP == _XMAX_
#define Z2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
#define Z2_MAX_PIN X_MAX_PIN
#elif Z2_USE_ENDSTOP == _YMAX_
#define Z2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
#define Z2_MAX_PIN Y_MAX_PIN
#elif Z2_USE_ENDSTOP == _ZMAX_
#define Z2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
#define Z2_MAX_PIN Z_MAX_PIN
#elif Z2_USE_ENDSTOP == _XMIN_
#define Z2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
#define Z2_MAX_PIN X_MIN_PIN
#elif Z2_USE_ENDSTOP == _YMIN_
#define Z2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
#define Z2_MAX_PIN Y_MIN_PIN
#elif Z2_USE_ENDSTOP == _ZMIN_
#define Z2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
#define Z2_MAX_PIN Z_MIN_PIN
#else
#define Z2_MAX_ENDSTOP_INVERTING false
#endif
#else
#define Z2_MAX_ENDSTOP_INVERTING false
#if Z2_USE_ENDSTOP == _XMAX_
#define Z2_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
#define Z2_MIN_PIN X_MAX_PIN
#elif Z2_USE_ENDSTOP == _YMAX_
#define Z2_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
#define Z2_MIN_PIN Y_MAX_PIN
#elif Z2_USE_ENDSTOP == _ZMAX_
#define Z2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
#define Z2_MIN_PIN Z_MAX_PIN
#elif Z2_USE_ENDSTOP == _XMIN_
#define Z2_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
#define Z2_MIN_PIN X_MIN_PIN
#elif Z2_USE_ENDSTOP == _YMIN_
#define Z2_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
#define Z2_MIN_PIN Y_MIN_PIN
#elif Z2_USE_ENDSTOP == _ZMIN_
#define Z2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
#define Z2_MIN_PIN Z_MIN_PIN
#else
#define Z2_MIN_ENDSTOP_INVERTING false
#endif
#endif
#endif
/**
* Set ENDSTOPPULLUPS for active endstop switches
*/
#if ENABLED(ENDSTOPPULLUPS)
#if ENABLED(USE_XMAX_PLUG)
#define ENDSTOPPULLUP_XMAX
#endif
#if ENABLED(USE_YMAX_PLUG)
#define ENDSTOPPULLUP_YMAX
#endif
#if ENABLED(USE_ZMAX_PLUG)
#define ENDSTOPPULLUP_ZMAX
#endif
#if ENABLED(USE_XMIN_PLUG)
#define ENDSTOPPULLUP_XMIN
#endif
#if ENABLED(USE_YMIN_PLUG)
#define ENDSTOPPULLUP_YMIN
#endif
#if ENABLED(USE_ZMIN_PLUG)
#define ENDSTOPPULLUP_ZMIN
#endif
#if DISABLED(DISABLE_Z_MIN_PROBE_ENDSTOP)
#define ENDSTOPPULLUP_ZMIN_PROBE
#endif
#endif

View File

@ -402,7 +402,7 @@ static uint8_t target_extruder;
#define XY_PROBE_FEEDRATE_MM_S PLANNER_XY_FEEDRATE()
#endif
#if ENABLED(Z_DUAL_ENDSTOPS) && DISABLED(DELTA)
#if ENABLED(Z_DUAL_ENDSTOPS)
float z_endstop_adj = 0;
#endif

View File

@ -728,13 +728,17 @@
* Endstops
*/
#if DISABLED(USE_XMIN_PLUG) && DISABLED(USE_XMAX_PLUG) && !(ENABLED(Z_DUAL_ENDSTOPS) && Z2_USE_ENDSTOP >= _XMAX_ && Z2_USE_ENDSTOP <= _XMIN_)
#error "You must enable USE_XMIN_PLUG or USE_XMAX_PLUG"
#error "You must enable USE_XMIN_PLUG or USE_XMAX_PLUG."
#elif DISABLED(USE_YMIN_PLUG) && DISABLED(USE_YMAX_PLUG) && !(ENABLED(Z_DUAL_ENDSTOPS) && Z2_USE_ENDSTOP >= _YMAX_ && Z2_USE_ENDSTOP <= _YMIN_)
#error "You must enable USE_YMIN_PLUG or USE_YMAX_PLUG"
#error "You must enable USE_YMIN_PLUG or USE_YMAX_PLUG."
#elif DISABLED(USE_ZMIN_PLUG) && DISABLED(USE_ZMAX_PLUG) && !(ENABLED(Z_DUAL_ENDSTOPS) && Z2_USE_ENDSTOP >= _ZMAX_ && Z2_USE_ENDSTOP <= _ZMIN_)
#error "You must enable USE_ZMIN_PLUG or USE_ZMAX_PLUG"
#elif ENABLED(Z_DUAL_ENDSTOPS) && !Z2_USE_ENDSTOP
#error "You must set Z2_USE_ENDSTOP with Z_DUAL_ENDSTOPS"
#error "You must enable USE_ZMIN_PLUG or USE_ZMAX_PLUG."
#elif ENABLED(Z_DUAL_ENDSTOPS)
#if !Z2_USE_ENDSTOP
#error "You must set Z2_USE_ENDSTOP with Z_DUAL_ENDSTOPS."
#elif ENABLED(DELTA)
#error "Z_DUAL_ENDSTOPS is not compatible with DELTA."
#endif
#endif
/**