Skip to content

Commit

Permalink
🔧 Fix Z_MULTI_ENDSTOPS pin post-process (MarlinFirmware#27137)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellensp authored Jun 8, 2024
1 parent 320e002 commit 1d29a56
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 12 deletions.
45 changes: 45 additions & 0 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -2466,6 +2466,51 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
#elif Z_SPI_SENSORLESS && !(AXIS_HAS_SPI(Z2) && (NUM_Z_STEPPERS < 3 || AXIS_HAS_SPI(Z3)) && (NUM_Z_STEPPERS < 4 || AXIS_HAS_SPI(Z4)))
#error "All Z Stepper Drivers must be SPI-capable to use SPI Endstops on Z."
#endif
#if PIN_EXISTS(Z2_STOP)
#if X_HOME_TO_MIN && Z2_STOP_PIN == X_MIN_PIN
#error "Z2_STOP_PIN can't be the same as X_MIN_PIN when homing to X_MIN"
#elif X_HOME_TO_MAX && Z2_STOP_PIN == X_MAX_PIN
#error "Z2_STOP_PIN can't be the same as X_MAX_PIN when homing to X_MAX"
#elif Y_HOME_TO_MIN && Z2_STOP_PIN == Y_MIN_PIN
#error "Z2_STOP_PIN can't be the same as Y_MIN_PIN when homing to Y_MIN"
#elif Y_HOME_TO_MAX && Z2_STOP_PIN == Y_MAX_PIN
#error "Z2_STOP_PIN can't be the same as Y_MAX_PIN when homing to Y_MAX"
#elif Z_HOME_TO_MIN && Z2_STOP_PIN == Z_MIN_PIN
#error "Z2_STOP_PIN can't be the same as Z_MIN_PIN when homing to Z_MIN"
#elif Z_HOME_TO_MAX && Z2_STOP_PIN == Z_MAX_PIN
#error "Z2_STOP_PIN can't be the same as Z_MAX_PIN when homing to Z_MAX"
#endif
#endif
#if PIN_EXISTS(Z3_STOP)
#if X_HOME_TO_MIN && Z3_STOP_PIN == X_MIN_PIN
#error "Z3_STOP_PIN can't be the same as X_MIN_PIN when homing to X_MIN"
#elif X_HOME_TO_MAX && Z3_STOP_PIN == X_MAX_PIN
#error "Z3_STOP_PIN can't be the same as X_MAX_PIN when homing to X_MAX"
#elif Y_HOME_TO_MIN && Z3_STOP_PIN == Y_MIN_PIN
#error "Z3_STOP_PIN can't be the same as Y_MIN_PIN when homing to Y_MIN"
#elif Y_HOME_TO_MAX && Z3_STOP_PIN == Y_MAX_PIN
#error "Z3_STOP_PIN can't be the same as Y_MAX_PIN when homing to Y_MAX"
#elif Z_HOME_TO_MIN && Z3_STOP_PIN == Z_MIN_PIN
#error "Z3_STOP_PIN can't be the same as Z_MIN_PIN when homing to Z_MIN"
#elif Z_HOME_TO_MAX && Z3_STOP_PIN == Z_MAX_PIN
#error "Z3_STOP_PIN can't be the same as Z_MAX_PIN when homing to Z_MAX"
#endif
#endif
#if PIN_EXISTS(Z4_STOP)
#if X_HOME_TO_MIN && Z4_STOP_PIN == X_MIN_PIN
#error "Z4_STOP_PIN can't be the same as X_MIN_PIN when homing to X_MIN"
#elif X_HOME_TO_MAX && Z4_STOP_PIN == X_MAX_PIN
#error "Z4_STOP_PIN can't be the same as X_MAX_PIN when homing to X_MAX"
#elif Y_HOME_TO_MIN && Z4_STOP_PIN == Y_MIN_PIN
#error "Z4_STOP_PIN can't be the same as Y_MIN_PIN when homing to Y_MIN"
#elif Y_HOME_TO_MAX && Z4_STOP_PIN == Y_MAX_PIN
#error "Z4_STOP_PIN can't be the same as Y_MAX_PIN when homing to Y_MAX"
#elif Z_HOME_TO_MIN && Z4_STOP_PIN == Z_MIN_PIN
#error "Z4_STOP_PIN can't be the same as Z_MIN_PIN when homing to Z_MIN"
#elif Z_HOME_TO_MAX && Z4_STOP_PIN == Z_MAX_PIN
#error "Z4_STOP_PIN can't be the same as Z_MAX_PIN when homing to Z_MAX"
#endif
#endif
#endif

#if defined(ENDSTOP_NOISE_THRESHOLD) && !WITHIN(ENDSTOP_NOISE_THRESHOLD, 2, 7)
Expand Down
22 changes: 11 additions & 11 deletions Marlin/src/pins/pins_postprocess.h
Original file line number Diff line number Diff line change
Expand Up @@ -556,20 +556,20 @@
#elif Z_HOME_TO_MAX
#define Z_MAX_PIN Z_STOP_PIN
#endif
#elif Z_HOME_TO_MIN
#define Z_STOP_PIN Z_MIN_PIN
#elif Z_HOME_TO_MAX
#define Z_STOP_PIN Z_MAX_PIN
#endif
#if ENABLED(Z_MULTI_ENDSTOPS) && PIN_EXISTS(Z_STOP)
#ifndef Z2_STOP_PIN
#define Z2_STOP_PIN Z_STOP_PIN
#if ENABLED(Z_MULTI_ENDSTOPS)
#if ((Z_HOME_TO_MIN && !defined(Z2_MIN_PIN)) || (Z_HOME_TO_MAX && !defined(Z2_MAX_PIN))) && !defined(Z2_STOP_PIN)
#error "Z2_STOP_PIN is required for Z_MULTI_ENDSTOPS. Define Z2_STOP_PIN in Configuration_adv.h."
#endif
#if NUM_Z_STEPPERS >= 3 && !defined(Z3_STOP_PIN)
#define Z3_STOP_PIN Z_STOP_PIN
#if NUM_Z_STEPPERS >= 3
#if ((Z_HOME_TO_MIN && !defined(Z3_MIN_PIN)) || (Z_HOME_TO_MAX && !defined(Z3_MAX_PIN))) && !defined(Z3_STOP_PIN)
#error "Z3_STOP_PIN is required for Z_MULTI_ENDSTOPS with NUM_Z_STEPPERS >= 3. Define Z3_STOP_PIN in Configuration_adv.h."
#endif
#endif
#if NUM_Z_STEPPERS >= 4 && !defined(Z4_STOP_PIN)
#define Z4_STOP_PIN Z_STOP_PIN
#if NUM_Z_STEPPERS >= 4
#if ((Z_HOME_TO_MIN && !defined(Z4_MIN_PIN)) || (Z_HOME_TO_MAX && !defined(Z4_MAX_PIN))) && !defined(Z4_STOP_PIN)
#error "Z4_STOP_PIN is required for Z_MULTI_ENDSTOPS with NUM_Z_STEPPERS == 4. Define Z4_STOP_PIN in Configuration_adv.h."
#endif
#endif
#endif
#endif
Expand Down
3 changes: 2 additions & 1 deletion buildroot/tests/BIGTREE_GTR_V1_0
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ restore_configs
opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 SERIAL_PORT -1 \
EXTRUDERS 5 TEMP_SENSOR_1 1 TEMP_SENSOR_2 1 TEMP_SENSOR_3 1 TEMP_SENSOR_4 1 \
Z_DRIVER_TYPE A4988 Z2_DRIVER_TYPE A4988 Z3_DRIVER_TYPE A4988 Z4_DRIVER_TYPE A4988 \
DEFAULT_Kp_LIST '{ 22.2, 20.0, 21.0, 19.0, 18.0 }' DEFAULT_Ki_LIST '{ 1.08 }' DEFAULT_Kd_LIST '{ 114.0, 112.0, 110.0, 108.0 }'
DEFAULT_Kp_LIST '{ 22.2, 20.0, 21.0, 19.0, 18.0 }' DEFAULT_Ki_LIST '{ 1.08 }' DEFAULT_Kd_LIST '{ 114.0, 112.0, 110.0, 108.0 }' \
Z3_STOP_PIN PI7 Z4_STOP_PIN PF6
opt_enable TOOLCHANGE_FILAMENT_SWAP TOOLCHANGE_MIGRATION_FEATURE TOOLCHANGE_FS_SLOW_FIRST_PRIME TOOLCHANGE_FS_PRIME_FIRST_USED \
REPRAP_DISCOUNT_SMART_CONTROLLER PID_PARAMS_PER_HOTEND Z_MULTI_ENDSTOPS TC_GCODE_USE_GLOBAL_X TC_GCODE_USE_GLOBAL_Y
exec_test $1 $2 "BigTreeTech GTR | 6 Extruders | Quad Z + Endstops" "$3"
Expand Down

0 comments on commit 1d29a56

Please sign in to comment.