Skip to content

Commit

Permalink
🐛 Fix up endstop flags (#22487, #22525)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 9, 2021
1 parent 83b8a0f commit a36a668
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 26 deletions.
10 changes: 6 additions & 4 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -2495,16 +2495,16 @@
#if _HAS_STOP(X,MAX)
#define HAS_X_MAX 1
#endif
#if HAS_Y_AXIS && _HAS_STOP(Y,MIN)
#if _HAS_STOP(Y,MIN)
#define HAS_Y_MIN 1
#endif
#if HAS_Y_AXIS && _HAS_STOP(Y,MAX)
#if _HAS_STOP(Y,MAX)
#define HAS_Y_MAX 1
#endif
#if BOTH(HAS_Z_AXIS, USE_ZMIN_PLUG) && _HAS_STOP(Z,MIN)
#if _HAS_STOP(Z,MIN)
#define HAS_Z_MIN 1
#endif
#if BOTH(HAS_Z_AXIS, USE_ZMAX_PLUG) && _HAS_STOP(Z,MAX)
#if _HAS_STOP(Z,MAX)
#define HAS_Z_MAX 1
#endif
#if _HAS_STOP(I,MIN)
Expand Down Expand Up @@ -2555,10 +2555,12 @@
#if PIN_EXISTS(Z4_MAX)
#define HAS_Z4_MAX 1
#endif

#if HAS_BED_PROBE && PIN_EXISTS(Z_MIN_PROBE)
#define HAS_Z_MIN_PROBE_PIN 1
#endif

#undef _HAS_STOP
#undef IS_PROBE_PIN
#undef IS_X2_ENDSTOP
#undef IS_Y2_ENDSTOP
Expand Down
30 changes: 10 additions & 20 deletions Marlin/src/module/endstops.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,16 @@ enum EndstopEnum : char {
_ES_ITEM(HAS_K_MAX, K_MAX)

// Extra Endstops for XYZ
#if ENABLED(X_DUAL_ENDSTOPS)
_ES_ITEM(HAS_X_MIN, X2_MIN)
_ES_ITEM(HAS_X_MAX, X2_MAX)
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
_ES_ITEM(HAS_Y_MIN, Y2_MIN)
_ES_ITEM(HAS_Y_MAX, Y2_MAX)
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
_ES_ITEM(HAS_Z_MIN, Z2_MIN)
_ES_ITEM(HAS_Z_MAX, Z2_MAX)
#if NUM_Z_STEPPER_DRIVERS >= 3
_ES_ITEM(HAS_Z_MIN, Z3_MIN)
_ES_ITEM(HAS_Z_MAX, Z3_MAX)
#endif
#if NUM_Z_STEPPER_DRIVERS >= 4
_ES_ITEM(HAS_Z_MIN, Z4_MIN)
_ES_ITEM(HAS_Z_MAX, Z4_MAX)
#endif
#endif
_ES_ITEM(HAS_X2_MIN, X2_MIN)
_ES_ITEM(HAS_X2_MAX, X2_MAX)
_ES_ITEM(HAS_Y2_MIN, Y2_MIN)
_ES_ITEM(HAS_Y2_MAX, Y2_MAX)
_ES_ITEM(HAS_Z2_MIN, Z2_MIN)
_ES_ITEM(HAS_Z2_MAX, Z2_MAX)
_ES_ITEM(HAS_Z3_MIN, Z3_MIN)
_ES_ITEM(HAS_Z3_MAX, Z3_MAX)
_ES_ITEM(HAS_Z4_MIN, Z4_MIN)
_ES_ITEM(HAS_Z4_MAX, Z4_MAX)

// Bed Probe state is distinct or shared with Z_MIN (i.e., when the probe is the only Z endstop)
_ES_ITEM(HAS_BED_PROBE, Z_MIN_PROBE IF_DISABLED(USES_Z_MIN_PROBE_PIN, = Z_MIN))
Expand Down
2 changes: 1 addition & 1 deletion buildroot/tests/teensy35
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ exec_test $1 $2 "Teensy 3.5/3.6 COREXZ | BACKLASH" "$3"
# Enable Dual Z with Dual Z endstops
#
restore_configs
opt_set MOTHERBOARD BOARD_TEENSY35_36 NUM_Z_STEPPER_DRIVERS 2 Z2_MAX_PIN 2
opt_set MOTHERBOARD BOARD_TEENSY35_36 NUM_Z_STEPPER_DRIVERS 2 Z2_MIN_PIN 2
opt_enable Z_MULTI_ENDSTOPS USE_XMAX_PLUG
pins_set ramps/RAMPS X_MAX_PIN -1
exec_test $1 $2 "Dual Z with Dual Z endstops" "$3"
Expand Down
2 changes: 1 addition & 1 deletion buildroot/tests/teensy41
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ exec_test $1 $2 "Teensy 4.0/4.1 COREXZ" "$3"
# Enable Dual Z with Dual Z endstops
#
restore_configs
opt_set MOTHERBOARD BOARD_TEENSY41 NUM_Z_STEPPER_DRIVERS 2 Z2_MAX_PIN 2
opt_set MOTHERBOARD BOARD_TEENSY41 NUM_Z_STEPPER_DRIVERS 2 Z2_MIN_PIN 2
opt_enable Z_MULTI_ENDSTOPS USE_XMAX_PLUG
pins_set ramps/RAMPS X_MAX_PIN -1
exec_test $1 $2 "Dual Z with Dual Z endstops" "$3"
Expand Down

0 comments on commit a36a668

Please sign in to comment.