Skip to content

Commit

Permalink
attempt simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jan 2, 2022
1 parent 037673d commit 8935888
Show file tree
Hide file tree
Showing 7 changed files with 261 additions and 363 deletions.
57 changes: 36 additions & 21 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -926,30 +926,45 @@
#elif X_HOME_DIR < 0
#define X_HOME_TO_MIN 1
#endif
#if Y_HOME_DIR > 0
#define Y_HOME_TO_MAX 1
#elif Y_HOME_DIR < 0
#define Y_HOME_TO_MIN 1
#if X2_HOME_DIR > 0
#define X2_HOME_TO_MAX 1
#elif X2_HOME_DIR < 0
#define X2_HOME_TO_MIN 1
#endif
#if Z_HOME_DIR > 0
#define Z_HOME_TO_MAX 1
#elif Z_HOME_DIR < 0
#define Z_HOME_TO_MIN 1
#if HAS_Y_AXIS
#if Y_HOME_DIR > 0
#define Y_HOME_TO_MAX 1
#elif Y_HOME_DIR < 0
#define Y_HOME_TO_MIN 1
#endif
#endif
#if HAS_Z_AXIS
#if Z_HOME_DIR > 0
#define Z_HOME_TO_MAX 1
#elif Z_HOME_DIR < 0
#define Z_HOME_TO_MIN 1
#endif
#endif
#if I_HOME_DIR > 0
#define I_HOME_TO_MAX 1
#elif I_HOME_DIR < 0
#define I_HOME_TO_MIN 1
#if LINEAR_AXES >= 4
#if I_HOME_DIR > 0
#define I_HOME_TO_MAX 1
#elif I_HOME_DIR < 0
#define I_HOME_TO_MIN 1
#endif
#endif
#if J_HOME_DIR > 0
#define J_HOME_TO_MAX 1
#elif J_HOME_DIR < 0
#define J_HOME_TO_MIN 1
#if LINEAR_AXES >= 5
#if J_HOME_DIR > 0
#define J_HOME_TO_MAX 1
#elif J_HOME_DIR < 0
#define J_HOME_TO_MIN 1
#endif
#endif
#if K_HOME_DIR > 0
#define K_HOME_TO_MAX 1
#elif K_HOME_DIR < 0
#define K_HOME_TO_MIN 1
#if LINEAR_AXES >= 6
#if K_HOME_DIR > 0
#define K_HOME_TO_MAX 1
#elif K_HOME_DIR < 0
#define K_HOME_TO_MIN 1
#endif
#endif

/**
Expand Down Expand Up @@ -1411,7 +1426,7 @@
#endif
#endif

#if ANY(USE_XMIN_PLUG, USE_YMIN_PLUG, USE_ZMIN_PLUG, USE_XMAX_PLUG, USE_YMAX_PLUG, USE_ZMAX_PLUG)
#if X_HOME_DIR || (HAS_Y_AXIS && Y_HOME_DIR) || (HAS_Z_AXIS && Z_HOME_DIR) || (LINEAR_AXES >= 4 && I_HOME_DIR) || (LINEAR_AXES >= 5 && J_HOME_DIR) || (LINEAR_AXES >= 6 && K_HOME_DIR)
#define HAS_ENDSTOPS 1
#define COORDINATE_OKAY(N,L,H) WITHIN(N,L,H)
#else
Expand Down
6 changes: 0 additions & 6 deletions Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -823,12 +823,6 @@
#define POLL_JOG
#endif

#if X2_HOME_DIR > 0
#define X2_HOME_TO_MAX 1
#elif X2_HOME_DIR < 0
#define X2_HOME_TO_MIN 1
#endif

#ifndef HOMING_BUMP_MM
#define HOMING_BUMP_MM { 0, 0, 0 }
#endif
Expand Down
122 changes: 75 additions & 47 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@
#define LIB_INTERNAL_MAX31865 1
#endif

#endif //HAS_MAX_TC
#endif // HAS_MAX_TC

/**
* X_DUAL_ENDSTOPS endstop reassignment
Expand Down Expand Up @@ -1104,7 +1104,7 @@
#define Z2_MIN_ENDSTOP_INVERTING false
#endif
#endif
#ifndef Z2_MIN_PIN
#if !defined(Z2_MIN_PIN) && !defined(Z2_STOP_PIN)
#if Z2_USE_ENDSTOP == _XMIN_
#define Z2_MIN_PIN X_MIN_PIN
#elif Z2_USE_ENDSTOP == _XMAX_
Expand Down Expand Up @@ -1422,40 +1422,40 @@
* Set ENDSTOPPULLUPS for active endstop switches
*/
#if ENABLED(ENDSTOPPULLUPS)
#if ENABLED(USE_XMAX_PLUG)
#if X_HOME_TO_MAX
#define ENDSTOPPULLUP_XMAX
#endif
#if ENABLED(USE_YMAX_PLUG)
#if Y_HOME_TO_MAX
#define ENDSTOPPULLUP_YMAX
#endif
#if ENABLED(USE_ZMAX_PLUG)
#if Z_HOME_TO_MAX
#define ENDSTOPPULLUP_ZMAX
#endif
#if ENABLED(USE_IMAX_PLUG)
#if I_HOME_TO_MAX
#define ENDSTOPPULLUP_IMAX
#endif
#if ENABLED(USE_JMAX_PLUG)
#if J_HOME_TO_MAX
#define ENDSTOPPULLUP_JMAX
#endif
#if ENABLED(USE_KMAX_PLUG)
#if K_HOME_TO_MAX
#define ENDSTOPPULLUP_KMAX
#endif
#if ENABLED(USE_XMIN_PLUG)
#if X_HOME_TO_MIN
#define ENDSTOPPULLUP_XMIN
#endif
#if ENABLED(USE_YMIN_PLUG)
#if Y_HOME_TO_MIN
#define ENDSTOPPULLUP_YMIN
#endif
#if ENABLED(USE_ZMIN_PLUG)
#if Z_HOME_TO_MIN
#define ENDSTOPPULLUP_ZMIN
#endif
#if ENABLED(USE_IMIN_PLUG)
#if I_HOME_TO_MIN
#define ENDSTOPPULLUP_IMIN
#endif
#if ENABLED(USE_JMIN_PLUG)
#if J_HOME_TO_MIN
#define ENDSTOPPULLUP_JMIN
#endif
#if ENABLED(USE_KMIN_PLUG)
#if K_HOME_TO_MIN
#define ENDSTOPPULLUP_KMIN
#endif
#endif
Expand All @@ -1464,24 +1464,42 @@
* Set ENDSTOPPULLDOWNS for active endstop switches
*/
#if ENABLED(ENDSTOPPULLDOWNS)
#if ENABLED(USE_XMAX_PLUG)
#if X_HOME_TO_MAX
#define ENDSTOPPULLDOWN_XMAX
#endif
#if ENABLED(USE_YMAX_PLUG)
#if Y_HOME_TO_MAX
#define ENDSTOPPULLDOWN_YMAX
#endif
#if ENABLED(USE_ZMAX_PLUG)
#if Z_HOME_TO_MAX
#define ENDSTOPPULLDOWN_ZMAX
#endif
#if ENABLED(USE_XMIN_PLUG)
#if I_HOME_TO_MAX
#define ENDSTOPPULLDOWN_IMAX
#endif
#if J_HOME_TO_MAX
#define ENDSTOPPULLDOWN_JMAX
#endif
#if K_HOME_TO_MAX
#define ENDSTOPPULLDOWN_KMAX
#endif
#if X_HOME_TO_MIN
#define ENDSTOPPULLDOWN_XMIN
#endif
#if ENABLED(USE_YMIN_PLUG)
#if Y_HOME_TO_MIN
#define ENDSTOPPULLDOWN_YMIN
#endif
#if ENABLED(USE_ZMIN_PLUG)
#if Z_HOME_TO_MIN
#define ENDSTOPPULLDOWN_ZMIN
#endif
#if I_HOME_TO_MIN
#define ENDSTOPPULLDOWN_IMIN
#endif
#if J_HOME_TO_MIN
#define ENDSTOPPULLDOWN_JMIN
#endif
#if K_HOME_TO_MIN
#define ENDSTOPPULLDOWN_KMIN
#endif
#endif

/**
Expand Down Expand Up @@ -2348,35 +2366,45 @@
#if _HAS_STOP(K,MAX)
#define HAS_K_MAX 1
#endif
#if PIN_EXISTS(X2_MIN)
#define HAS_X2_MIN 1
#endif
#if PIN_EXISTS(X2_MAX)
#define HAS_X2_MAX 1
#endif
#if PIN_EXISTS(Y2_MIN)
#define HAS_Y2_MIN 1
#endif
#if PIN_EXISTS(Y2_MAX)
#define HAS_Y2_MAX 1
#endif
#if PIN_EXISTS(Z2_MIN)
#define HAS_Z2_MIN 1
#endif
#if PIN_EXISTS(Z2_MAX)
#define HAS_Z2_MAX 1
#endif
#if PIN_EXISTS(Z3_MIN)
#define HAS_Z3_MIN 1
#endif
#if PIN_EXISTS(Z3_MAX)
#define HAS_Z3_MAX 1
#if ENABLED(X_DUAL_ENDSTOPS)
#if PIN_EXISTS(X2_MIN)
#define HAS_X2_MIN 1
#endif
#if PIN_EXISTS(X2_MAX)
#define HAS_X2_MAX 1
#endif
#endif
#if PIN_EXISTS(Z4_MIN)
#define HAS_Z4_MIN 1
#if ENABLED(Y_DUAL_ENDSTOPS)
#if PIN_EXISTS(Y2_MIN)
#define HAS_Y2_MIN 1
#endif
#if PIN_EXISTS(Y2_MAX)
#define HAS_Y2_MAX 1
#endif
#endif
#if PIN_EXISTS(Z4_MAX)
#define HAS_Z4_MAX 1
#if ENABLED(Z_MULTI_ENDSTOPS)
#if PIN_EXISTS(Z2_MIN)
#define HAS_Z2_MIN 1
#endif
#if PIN_EXISTS(Z2_MAX)
#define HAS_Z2_MAX 1
#endif
#if NUM_Z_STEPPER_DRIVERS >= 3
#if PIN_EXISTS(Z3_MIN)
#define HAS_Z3_MIN 1
#endif
#if PIN_EXISTS(Z3_MAX)
#define HAS_Z3_MAX 1
#endif
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4
#if PIN_EXISTS(Z4_MIN)
#define HAS_Z4_MIN 1
#endif
#if PIN_EXISTS(Z4_MAX)
#define HAS_Z4_MAX 1
#endif
#endif
#endif

#if HAS_BED_PROBE && PIN_EXISTS(Z_MIN_PROBE)
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -2389,10 +2389,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#if _AXIS_PLUG_UNUSED_TEST(X)
#error "You must enable USE_XMIN_PLUG or USE_XMAX_PLUG."
#endif
#if _AXIS_PLUG_UNUSED_TEST(Y)
#if HAS_Y_AXIS && _AXIS_PLUG_UNUSED_TEST(Y)
#error "You must enable USE_YMIN_PLUG or USE_YMAX_PLUG."
#endif
#if _AXIS_PLUG_UNUSED_TEST(Z)
#if HAS_Z_AXIS && _AXIS_PLUG_UNUSED_TEST(Z)
#error "You must enable USE_ZMIN_PLUG or USE_ZMAX_PLUG."
#endif
#if LINEAR_AXES >= 4 && _AXIS_PLUG_UNUSED_TEST(I)
Expand Down
Loading

0 comments on commit 8935888

Please sign in to comment.