Browse Source

Simplify / undef extra endstops (#21808)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
vanilla_fb_2.0.x
ellensp 3 years ago
committed by Scott Lahteine
parent
commit
5cf0975913
  1. 18
      Marlin/src/inc/Conditionals_post.h
  2. 103
      Marlin/src/inc/SanityCheck.h
  3. 56
      Marlin/src/pins/pins_postprocess.h

18
Marlin/src/inc/Conditionals_post.h

@ -1983,15 +1983,6 @@
#if _HAS_STOP(Z,MAX)
#define HAS_Z_MAX 1
#endif
#if _HAS_STOP(X,STOP)
#define HAS_X_STOP 1
#endif
#if _HAS_STOP(Y,STOP)
#define HAS_Y_STOP 1
#endif
#if _HAS_STOP(Z,STOP)
#define HAS_Z_STOP 1
#endif
#if PIN_EXISTS(X2_MIN)
#define HAS_X2_MIN 1
#endif
@ -2022,10 +2013,17 @@
#if PIN_EXISTS(Z4_MAX)
#define HAS_Z4_MAX 1
#endif
#if HAS_CUSTOM_PROBE_PIN && PIN_EXISTS(Z_MIN_PROBE)
#if BOTH(HAS_BED_PROBE, HAS_CUSTOM_PROBE_PIN) && PIN_EXISTS(Z_MIN_PROBE)
#define HAS_Z_MIN_PROBE_PIN 1
#endif
#undef IS_PROBE_PIN
#undef IS_X2_ENDSTOP
#undef IS_Y2_ENDSTOP
#undef IS_Z2_ENDSTOP
#undef IS_Z3_ENDSTOP
#undef IS_Z4_ENDSTOP
//
// ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface)
//

103
Marlin/src/inc/SanityCheck.h

@ -2101,105 +2101,28 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
// Dual/multiple endstops requirements
#if ENABLED(X_DUAL_ENDSTOPS)
#if !X2_USE_ENDSTOP
#error "You must set X2_USE_ENDSTOP with X_DUAL_ENDSTOPS."
#elif X2_USE_ENDSTOP == _XMIN_ && DISABLED(USE_XMIN_PLUG)
#error "USE_XMIN_PLUG is required when X2_USE_ENDSTOP is _XMIN_."
#elif X2_USE_ENDSTOP == _XMAX_ && DISABLED(USE_XMAX_PLUG)
#error "USE_XMAX_PLUG is required when X2_USE_ENDSTOP is _XMAX_."
#elif X2_USE_ENDSTOP == _YMIN_ && DISABLED(USE_YMIN_PLUG)
#error "USE_YMIN_PLUG is required when X2_USE_ENDSTOP is _YMIN_."
#elif X2_USE_ENDSTOP == _YMAX_ && DISABLED(USE_YMAX_PLUG)
#error "USE_YMAX_PLUG is required when X2_USE_ENDSTOP is _YMAX_."
#elif X2_USE_ENDSTOP == _ZMIN_ && DISABLED(USE_ZMIN_PLUG)
#error "USE_ZMIN_PLUG is required when X2_USE_ENDSTOP is _ZMIN_."
#elif X2_USE_ENDSTOP == _ZMAX_ && DISABLED(USE_ZMAX_PLUG)
#error "USE_ZMAX_PLUG is required when X2_USE_ENDSTOP is _ZMAX_."
#elif !HAS_X2_MIN && !HAS_X2_MAX
#error "X2_USE_ENDSTOP has been assigned to a nonexistent endstop!"
#elif ENABLED(DELTA)
#if ENABLED(DELTA)
#error "X_DUAL_ENDSTOPS is not compatible with DELTA."
#elif !X2_USE_ENDSTOP
#error "X2_USE_ENDSTOP must be set with X_DUAL_ENDSTOPS."
#endif
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
#if !Y2_USE_ENDSTOP
#error "You must set Y2_USE_ENDSTOP with Y_DUAL_ENDSTOPS."
#elif Y2_USE_ENDSTOP == _XMIN_ && DISABLED(USE_XMIN_PLUG)
#error "USE_XMIN_PLUG is required when Y2_USE_ENDSTOP is _XMIN_."
#elif Y2_USE_ENDSTOP == _XMAX_ && DISABLED(USE_XMAX_PLUG)
#error "USE_XMAX_PLUG is required when Y2_USE_ENDSTOP is _XMAX_."
#elif Y2_USE_ENDSTOP == _YMIN_ && DISABLED(USE_YMIN_PLUG)
#error "USE_YMIN_PLUG is required when Y2_USE_ENDSTOP is _YMIN_."
#elif Y2_USE_ENDSTOP == _YMAX_ && DISABLED(USE_YMAX_PLUG)
#error "USE_YMAX_PLUG is required when Y2_USE_ENDSTOP is _YMAX_."
#elif Y2_USE_ENDSTOP == _ZMIN_ && DISABLED(USE_ZMIN_PLUG)
#error "USE_ZMIN_PLUG is required when Y2_USE_ENDSTOP is _ZMIN_."
#elif Y2_USE_ENDSTOP == _ZMAX_ && DISABLED(USE_ZMAX_PLUG)
#error "USE_ZMAX_PLUG is required when Y2_USE_ENDSTOP is _ZMAX_."
#elif !HAS_Y2_MIN && !HAS_Y2_MAX
#error "Y2_USE_ENDSTOP has been assigned to a nonexistent endstop!"
#elif ENABLED(DELTA)
#if ENABLED(DELTA)
#error "Y_DUAL_ENDSTOPS is not compatible with DELTA."
#elif !Y2_USE_ENDSTOP
#error "Y2_USE_ENDSTOP must be set with Y_DUAL_ENDSTOPS."
#endif
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
#if !Z2_USE_ENDSTOP
#error "You must set Z2_USE_ENDSTOP with Z_MULTI_ENDSTOPS when NUM_Z_STEPPER_DRIVERS >= 2."
#elif Z2_USE_ENDSTOP == _XMIN_ && DISABLED(USE_XMIN_PLUG)
#error "USE_XMIN_PLUG is required when Z2_USE_ENDSTOP is _XMIN_."
#elif Z2_USE_ENDSTOP == _XMAX_ && DISABLED(USE_XMAX_PLUG)
#error "USE_XMAX_PLUG is required when Z2_USE_ENDSTOP is _XMAX_."
#elif Z2_USE_ENDSTOP == _YMIN_ && DISABLED(USE_YMIN_PLUG)
#error "USE_YMIN_PLUG is required when Z2_USE_ENDSTOP is _YMIN_."
#elif Z2_USE_ENDSTOP == _YMAX_ && DISABLED(USE_YMAX_PLUG)
#error "USE_YMAX_PLUG is required when Z2_USE_ENDSTOP is _YMAX_."
#elif Z2_USE_ENDSTOP == _ZMIN_ && DISABLED(USE_ZMIN_PLUG)
#error "USE_ZMIN_PLUG is required when Z2_USE_ENDSTOP is _ZMIN_."
#elif Z2_USE_ENDSTOP == _ZMAX_ && DISABLED(USE_ZMAX_PLUG)
#error "USE_ZMAX_PLUG is required when Z2_USE_ENDSTOP is _ZMAX_."
#elif !HAS_Z2_MIN && !HAS_Z2_MAX
#error "Z2_USE_ENDSTOP has been assigned to a nonexistent endstop!"
#elif ENABLED(DELTA)
#if ENABLED(DELTA)
#error "Z_MULTI_ENDSTOPS is not compatible with DELTA."
#endif
#if NUM_Z_STEPPER_DRIVERS >= 3
#if !Z3_USE_ENDSTOP
#error "You must set Z3_USE_ENDSTOP with Z_MULTI_ENDSTOPS when NUM_Z_STEPPER_DRIVERS >= 3."
#elif Z3_USE_ENDSTOP == _XMIN_ && DISABLED(USE_XMIN_PLUG)
#error "USE_XMIN_PLUG is required when Z3_USE_ENDSTOP is _XMIN_."
#elif Z3_USE_ENDSTOP == _XMAX_ && DISABLED(USE_XMAX_PLUG)
#error "USE_XMAX_PLUG is required when Z3_USE_ENDSTOP is _XMAX_."
#elif Z3_USE_ENDSTOP == _YMIN_ && DISABLED(USE_YMIN_PLUG)
#error "USE_YMIN_PLUG is required when Z3_USE_ENDSTOP is _YMIN_."
#elif Z3_USE_ENDSTOP == _YMAX_ && DISABLED(USE_YMAX_PLUG)
#error "USE_YMAX_PLUG is required when Z3_USE_ENDSTOP is _YMAX_."
#elif Z3_USE_ENDSTOP == _ZMIN_ && DISABLED(USE_ZMIN_PLUG)
#error "USE_ZMIN_PLUG is required when Z3_USE_ENDSTOP is _ZMIN_."
#elif Z3_USE_ENDSTOP == _ZMAX_ && DISABLED(USE_ZMAX_PLUG)
#error "USE_ZMAX_PLUG is required when Z3_USE_ENDSTOP is _ZMAX_."
#elif !HAS_Z3_MIN && !HAS_Z3_MAX
#error "Z3_USE_ENDSTOP has been assigned to a nonexistent endstop!"
#endif
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4
#if !Z4_USE_ENDSTOP
#error "You must set Z4_USE_ENDSTOP with Z_MULTI_ENDSTOPS when NUM_Z_STEPPER_DRIVERS >= 4."
#elif Z4_USE_ENDSTOP == _XMIN_ && DISABLED(USE_XMIN_PLUG)
#error "USE_XMIN_PLUG is required when Z4_USE_ENDSTOP is _XMIN_."
#elif Z4_USE_ENDSTOP == _XMAX_ && DISABLED(USE_XMAX_PLUG)
#error "USE_XMAX_PLUG is required when Z4_USE_ENDSTOP is _XMAX_."
#elif Z4_USE_ENDSTOP == _YMIN_ && DISABLED(USE_YMIN_PLUG)
#error "USE_YMIN_PLUG is required when Z4_USE_ENDSTOP is _YMIN_."
#elif Z4_USE_ENDSTOP == _YMAX_ && DISABLED(USE_YMAX_PLUG)
#error "USE_YMAX_PLUG is required when Z4_USE_ENDSTOP is _YMAX_."
#elif Z4_USE_ENDSTOP == _ZMIN_ && DISABLED(USE_ZMIN_PLUG)
#error "USE_ZMIN_PLUG is required when Z4_USE_ENDSTOP is _ZMIN_."
#elif Z4_USE_ENDSTOP == _ZMAX_ && DISABLED(USE_ZMAX_PLUG)
#error "USE_ZMAX_PLUG is required when Z4_USE_ENDSTOP is _ZMAX_."
#elif !HAS_Z4_MIN && !HAS_Z4_MAX
#error "Z4_USE_ENDSTOP has been assigned to a nonexistent endstop!"
#endif
#elif !Z2_USE_ENDSTOP
#error "Z2_USE_ENDSTOP must be set with Z_MULTI_ENDSTOPS."
#elif !Z3_USE_ENDSTOP && NUM_Z_STEPPER_DRIVERS >= 3
#error "Z3_USE_ENDSTOP must be set with Z_MULTI_ENDSTOPS and NUM_Z_STEPPER_DRIVERS >= 3."
#elif !Z4_USE_ENDSTOP && NUM_Z_STEPPER_DRIVERS >= 4
#error "Z4_USE_ENDSTOP must be set with Z_MULTI_ENDSTOPS and NUM_Z_STEPPER_DRIVERS >= 4."
#endif
#endif

56
Marlin/src/pins/pins_postprocess.h

@ -441,40 +441,84 @@
//
// Disable unused endstop / probe pins
//
#define _STOP_IN_USE(N) (X2_USE_ENDSTOP == N || Y2_USE_ENDSTOP == N || Z2_USE_ENDSTOP == N || Z3_USE_ENDSTOP == N || Z4_USE_ENDSTOP == N)
#if _STOP_IN_USE(_XMAX_)
#define USE_XMAX_PLUG
#endif
#if _STOP_IN_USE(_YMAX_)
#define USE_YMAX_PLUG
#endif
#if _STOP_IN_USE(_ZMAX_)
#define USE_ZMAX_PLUG
#endif
#if _STOP_IN_USE(_XMIN_)
#define USE_XMIN_PLUG
#endif
#if _STOP_IN_USE(_YMIN_)
#define USE_YMIN_PLUG
#endif
#if _STOP_IN_USE(_ZMIN_)
#define USE_ZMIN_PLUG
#endif
#undef _STOP_IN_USE
#if !HAS_CUSTOM_PROBE_PIN
#undef Z_MIN_PROBE_PIN
#define Z_MIN_PROBE_PIN -1
#endif
#if DISABLED(USE_XMAX_PLUG)
#undef X_MAX_PIN
#define X_MAX_PIN -1
#endif
#if DISABLED(USE_YMAX_PLUG)
#undef Y_MAX_PIN
#define Y_MAX_PIN -1
#endif
#if DISABLED(USE_ZMAX_PLUG)
#undef Z_MAX_PIN
#define Z_MAX_PIN -1
#endif
#if DISABLED(USE_XMIN_PLUG)
#undef X_MIN_PIN
#define X_MIN_PIN -1
#endif
#if DISABLED(USE_YMIN_PLUG)
#undef Y_MIN_PIN
#define Y_MIN_PIN -1
#endif
#if DISABLED(USE_ZMIN_PLUG)
#undef Z_MIN_PIN
#define Z_MIN_PIN -1
#endif
#if DISABLED(X_DUAL_ENDSTOPS) || X_HOME_DIR > 0
#undef X2_MIN_PIN
#endif
#if DISABLED(X_DUAL_ENDSTOPS) || X_HOME_DIR < 0
#undef X2_MAX_PIN
#endif
#if DISABLED(Y_DUAL_ENDSTOPS) || Y_HOME_DIR > 0
#undef Y2_MIN_PIN
#endif
#if DISABLED(Y_DUAL_ENDSTOPS) || Y_HOME_DIR < 0
#undef Y2_MAX_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || Z_HOME_DIR > 0
#undef Z2_MIN_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || Z_HOME_DIR < 0
#undef Z2_MAX_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 3 || Z_HOME_DIR > 0
#undef Z3_MIN_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 3 || Z_HOME_DIR < 0
#undef Z3_MAX_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 4 || Z_HOME_DIR > 0
#undef Z4_MIN_PIN
#endif
#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 4 || Z_HOME_DIR < 0
#undef Z4_MAX_PIN
#endif
#if HAS_FILAMENT_SENSOR
#define FIL_RUNOUT1_PIN FIL_RUNOUT_PIN

Loading…
Cancel
Save