From 1d29a563440e19b839c90786c008a2169fb1e0f9 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 9 Jun 2024 06:27:13 +1200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Fix=20Z=5FMULTI=5FENDSTOPS=20pin?= =?UTF-8?q?=20post-process=20(#27137)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 45 ++++++++++++++++++++++++++++++ Marlin/src/pins/pins_postprocess.h | 22 +++++++-------- buildroot/tests/BIGTREE_GTR_V1_0 | 3 +- 3 files changed, 58 insertions(+), 12 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 0383d29a690a..1482899bea0c 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -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) diff --git a/Marlin/src/pins/pins_postprocess.h b/Marlin/src/pins/pins_postprocess.h index 891076b2db4d..7b1b4fd0ade6 100644 --- a/Marlin/src/pins/pins_postprocess.h +++ b/Marlin/src/pins/pins_postprocess.h @@ -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 diff --git a/buildroot/tests/BIGTREE_GTR_V1_0 b/buildroot/tests/BIGTREE_GTR_V1_0 index 932317598652..dcfd2b3eefb4 100755 --- a/buildroot/tests/BIGTREE_GTR_V1_0 +++ b/buildroot/tests/BIGTREE_GTR_V1_0 @@ -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"