From 674ee22741b3965bc2c484f9a4bc72bb4536f769 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 8 May 2022 23:29:51 +1200 Subject: [PATCH 1/7] check for common serial port pin conflicts in AVR --- Marlin/src/inc/SanityCheck.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 59effff1a310..f2a914b06797 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -733,6 +733,39 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices." #endif +/** + * check for common serial pin conflicts (AVR only) + */ +#if defined(__AVR__) + #if CONF_SERIAL_IS(0) + //D0 and D1. No known conflicts + #endif + #if CONF_SERIAL_IS(1) + //D18 and D19, can conflict with X_STOP_PIN, Y_STOP_PIN, Z_STOP_PIN, Z_MIN_PIN, Z_MAX_PIN + #undef CHECK_SERIAL_PIN + #define CHECK_SERIAL_PIN(N) X_STOP_PIN == N || Y_STOP_PIN == N || Z_STOP_PIN == N || Z_MIN_PIN == N || Z_MAX_PIN == N + #if CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19) + #error "Serial port 1 pins D18 or D19 is in conflict with other pins on your motherboard" + #endif + #endif + #if CONF_SERIAL_IS(2) + //D16 and D17, can conflict with X_DIR_PIN, X_STEP_PIN, Y_DIR_PIN, Y_MIN_PIN, Y_MAX_PIN, Z_STEP_PIN + #undef CHECK_SERIAL_PIN + #define CHECK_SERIAL_PIN(N) X_DIR_PIN == N || X_STEP_PIN == N || Y_DIR_PIN == N || Y_MIN_PIN == N || Y_MAX_PIN == N || Y_MAX_PIN == N + #if CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17) + #error "Serial port 2 pins D16 or D17 is in conflict with other pins on your motherboard" + #endif + #endif + #if CONF_SERIAL_IS(3) + //D14 and D15, , can conflict with X_STEP_PIN, X_DIR_PIN, X_MIN_PIN, Y_STOP_PIN, Y_MIN_PIN. Y_MAX_PIN, Z_STOP_PIN + #undef CHECK_SERIAL_PIN + #define CHECK_SERIAL_PIN(N) X_STEP_PIN == N || X_DIR_PIN == N || X_MIN_PIN == N || Y_STOP_PIN == N || Y_MIN_PIN == N || Y_MAX_PIN == N || Z_STOP_PIN == N + #if CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15) + #error "Serial port 3 pin D14 or D15 is in conflict with other pins on your motherboard" + #endif + #endif +#endif + /** * Multiple Stepper Drivers Per Axis */ From f9e64ca7d2fef2230f2aa02f18a6d14e3aae0316 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 8 May 2022 23:42:19 +1200 Subject: [PATCH 2/7] remove some s's --- Marlin/src/inc/SanityCheck.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index f2a914b06797..63d9ad85bf7a 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -745,7 +745,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #undef CHECK_SERIAL_PIN #define CHECK_SERIAL_PIN(N) X_STOP_PIN == N || Y_STOP_PIN == N || Z_STOP_PIN == N || Z_MIN_PIN == N || Z_MAX_PIN == N #if CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19) - #error "Serial port 1 pins D18 or D19 is in conflict with other pins on your motherboard" + #error "Serial port 1 pin D18 or D19 is in conflict with other pins on your motherboard" #endif #endif #if CONF_SERIAL_IS(2) @@ -753,7 +753,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #undef CHECK_SERIAL_PIN #define CHECK_SERIAL_PIN(N) X_DIR_PIN == N || X_STEP_PIN == N || Y_DIR_PIN == N || Y_MIN_PIN == N || Y_MAX_PIN == N || Y_MAX_PIN == N #if CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17) - #error "Serial port 2 pins D16 or D17 is in conflict with other pins on your motherboard" + #error "Serial port 2 pin D16 or D17 is in conflict with other pins on your motherboard" #endif #endif #if CONF_SERIAL_IS(3) From 983654920cd9ddefddb9704ff585f886a1e3d711 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 12 May 2022 04:26:05 -0500 Subject: [PATCH 3/7] fix fysetc f6 test --- buildroot/tests/FYSETC_F6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot/tests/FYSETC_F6 b/buildroot/tests/FYSETC_F6 index 9306686af5ce..17f8eb42b1e2 100755 --- a/buildroot/tests/FYSETC_F6 +++ b/buildroot/tests/FYSETC_F6 @@ -10,7 +10,7 @@ set -e # Build with the default configurations # restore_configs -opt_set MOTHERBOARD BOARD_FYSETC_F6_13 +opt_set MOTHERBOARD BOARD_FYSETC_F6_13 LCD_SERIAL_PORT 1 opt_enable DGUS_LCD_UI_FYSETC exec_test $1 $2 "FYSETC F6 1.3 with DGUS" "$3" From d5c4ee33c8562487c96f2f69c5cc2ee0e3273169 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 12 May 2022 03:06:41 -0500 Subject: [PATCH 4/7] move sanity check to HAL --- Marlin/src/HAL/AVR/inc/SanityCheck.h | 31 ++++++++++++++++++++++++++ Marlin/src/inc/SanityCheck.h | 33 ---------------------------- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/Marlin/src/HAL/AVR/inc/SanityCheck.h b/Marlin/src/HAL/AVR/inc/SanityCheck.h index 15a5be4cd257..7e4a1d939b92 100644 --- a/Marlin/src/HAL/AVR/inc/SanityCheck.h +++ b/Marlin/src/HAL/AVR/inc/SanityCheck.h @@ -25,6 +25,37 @@ * Test AVR-specific configuration values for errors at compile-time. */ +/** + * Check for common serial pin conflicts + */ +#if CONF_SERIAL_IS(0) + // D0-D1. No known conflicts. +#endif +#if CONF_SERIAL_IS(1) + // D18-D19 can conflict with ... + #define CHECK_SERIAL_PIN(N) (X_STOP_PIN == N || Y_STOP_PIN == N || Z_STOP_PIN == N || Z_MIN_PIN == N || Z_MAX_PIN == N) + #if CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19) + #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board." + #endif + #undef CHECK_SERIAL_PIN +#endif +#if CONF_SERIAL_IS(2) + // D16-D17 can conflict with ... + #define CHECK_SERIAL_PIN(N) (X_DIR_PIN == N || X_STEP_PIN == N || Y_DIR_PIN == N || Y_MIN_PIN == N || Y_MAX_PIN == N || Z_STEP_PIN == N) + #if CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17) + #error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board." + #endif + #undef CHECK_SERIAL_PIN +#endif +#if CONF_SERIAL_IS(3) + // D14-D15 can conflict with ... + #define CHECK_SERIAL_PIN(N) (X_STEP_PIN == N || X_DIR_PIN == N || X_MIN_PIN == N || Y_STOP_PIN == N || Y_MIN_PIN == N || Y_MAX_PIN == N || Z_STOP_PIN == N) + #if CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15) + #error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board." + #endif + #undef CHECK_SERIAL_PIN +#endif + /** * Checks for FAST PWM */ diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 46095da39b83..2a85a589b991 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -739,39 +739,6 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices." #endif -/** - * check for common serial pin conflicts (AVR only) - */ -#if defined(__AVR__) - #if CONF_SERIAL_IS(0) - //D0 and D1. No known conflicts - #endif - #if CONF_SERIAL_IS(1) - //D18 and D19, can conflict with X_STOP_PIN, Y_STOP_PIN, Z_STOP_PIN, Z_MIN_PIN, Z_MAX_PIN - #undef CHECK_SERIAL_PIN - #define CHECK_SERIAL_PIN(N) X_STOP_PIN == N || Y_STOP_PIN == N || Z_STOP_PIN == N || Z_MIN_PIN == N || Z_MAX_PIN == N - #if CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19) - #error "Serial port 1 pin D18 or D19 is in conflict with other pins on your motherboard" - #endif - #endif - #if CONF_SERIAL_IS(2) - //D16 and D17, can conflict with X_DIR_PIN, X_STEP_PIN, Y_DIR_PIN, Y_MIN_PIN, Y_MAX_PIN, Z_STEP_PIN - #undef CHECK_SERIAL_PIN - #define CHECK_SERIAL_PIN(N) X_DIR_PIN == N || X_STEP_PIN == N || Y_DIR_PIN == N || Y_MIN_PIN == N || Y_MAX_PIN == N || Y_MAX_PIN == N - #if CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17) - #error "Serial port 2 pin D16 or D17 is in conflict with other pins on your motherboard" - #endif - #endif - #if CONF_SERIAL_IS(3) - //D14 and D15, , can conflict with X_STEP_PIN, X_DIR_PIN, X_MIN_PIN, Y_STOP_PIN, Y_MIN_PIN. Y_MAX_PIN, Z_STOP_PIN - #undef CHECK_SERIAL_PIN - #define CHECK_SERIAL_PIN(N) X_STEP_PIN == N || X_DIR_PIN == N || X_MIN_PIN == N || Y_STOP_PIN == N || Y_MIN_PIN == N || Y_MAX_PIN == N || Z_STOP_PIN == N - #if CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15) - #error "Serial port 3 pin D14 or D15 is in conflict with other pins on your motherboard" - #endif - #endif -#endif - /** * Multiple Stepper Drivers Per Axis */ From 487238844a055452f58a8c859a5c06bb912cf460 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 12 May 2022 03:18:26 -0500 Subject: [PATCH 5/7] #undef stop pins --- Marlin/src/pins/pins_postprocess.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Marlin/src/pins/pins_postprocess.h b/Marlin/src/pins/pins_postprocess.h index 990f40ad4de8..c3c217557beb 100644 --- a/Marlin/src/pins/pins_postprocess.h +++ b/Marlin/src/pins/pins_postprocess.h @@ -1664,6 +1664,9 @@ #undef X_MAX_PIN #define X_MAX_PIN -1 #endif +#if NONE(USE_XMIN_PLUG, USE_XMAX_PLUG) + #undef X_STOP_PIN +#endif #if DISABLED(USE_YMIN_PLUG) #undef Y_MIN_PIN #define Y_MIN_PIN -1 @@ -1672,6 +1675,9 @@ #undef Y_MAX_PIN #define Y_MAX_PIN -1 #endif +#if NONE(USE_YMIN_PLUG, USE_YMAX_PLUG) + #undef Y_STOP_PIN +#endif #if DISABLED(USE_ZMIN_PLUG) #undef Z_MIN_PIN #define Z_MIN_PIN -1 @@ -1680,6 +1686,9 @@ #undef Z_MAX_PIN #define Z_MAX_PIN -1 #endif +#if NONE(USE_ZMIN_PLUG, USE_ZMAX_PLUG) + #undef Z_STOP_PIN +#endif #if DISABLED(USE_IMIN_PLUG) #undef I_MIN_PIN #define I_MIN_PIN -1 @@ -1688,6 +1697,9 @@ #undef I_MAX_PIN #define I_MAX_PIN -1 #endif +#if NONE(USE_IMIN_PLUG, USE_IMAX_PLUG) + #undef I_STOP_PIN +#endif #if DISABLED(USE_JMIN_PLUG) #undef J_MIN_PIN #define J_MIN_PIN -1 @@ -1696,6 +1708,9 @@ #undef J_MAX_PIN #define J_MAX_PIN -1 #endif +#if NONE(USE_JMIN_PLUG, USE_JMAX_PLUG) + #undef J_STOP_PIN +#endif #if DISABLED(USE_KMIN_PLUG) #undef K_MIN_PIN #define K_MIN_PIN -1 @@ -1704,6 +1719,9 @@ #undef K_MAX_PIN #define K_MAX_PIN -1 #endif +#if NONE(USE_KMIN_PLUG, USE_KMAX_PLUG) + #undef K_STOP_PIN +#endif #if DISABLED(USE_UMIN_PLUG) #undef U_MIN_PIN #define U_MIN_PIN -1 @@ -1712,6 +1730,9 @@ #undef U_MAX_PIN #define U_MAX_PIN -1 #endif +#if NONE(USE_UMIN_PLUG, USE_UMAX_PLUG) + #undef U_STOP_PIN +#endif #if DISABLED(USE_VMIN_PLUG) #undef V_MIN_PIN #define V_MIN_PIN -1 @@ -1720,6 +1741,9 @@ #undef V_MAX_PIN #define V_MAX_PIN -1 #endif +#if NONE(USE_VMIN_PLUG, USE_VMAX_PLUG) + #undef V_STOP_PIN +#endif #if DISABLED(USE_WMIN_PLUG) #undef W_MIN_PIN #define W_MIN_PIN -1 @@ -1728,6 +1752,9 @@ #undef W_MAX_PIN #define W_MAX_PIN -1 #endif +#if NONE(USE_WMIN_PLUG, USE_WMAX_PLUG) + #undef W_STOP_PIN +#endif #if DISABLED(X_DUAL_ENDSTOPS) || X_HOME_TO_MAX #undef X2_MIN_PIN From a82bfbf198bdaccabc09968a3309afdb279e5320 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 12 May 2022 04:15:26 -0500 Subject: [PATCH 6/7] indent --- Marlin/src/pins/mega/pins_GT2560_V3_MC2.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Marlin/src/pins/mega/pins_GT2560_V3_MC2.h b/Marlin/src/pins/mega/pins_GT2560_V3_MC2.h index 6b22b4139b6d..e683d4dfda4b 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V3_MC2.h +++ b/Marlin/src/pins/mega/pins_GT2560_V3_MC2.h @@ -27,9 +27,9 @@ #define BOARD_INFO_NAME "GT2560 V3.0 (MC2)" -#define X_MIN_PIN 22 -#define X_MAX_PIN 24 -#define Y_MIN_PIN 26 -#define Y_MAX_PIN 28 +#define X_MIN_PIN 22 +#define X_MAX_PIN 24 +#define Y_MIN_PIN 26 +#define Y_MAX_PIN 28 #include "pins_GT2560_V3.h" From 3287f073aae6cab6347434fd90cab2f1a1a156d2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 12 May 2022 05:50:46 -0500 Subject: [PATCH 7/7] sanity for sam/due --- Marlin/src/HAL/AVR/inc/SanityCheck.h | 39 ++++++++++++---------------- Marlin/src/HAL/DUE/inc/SanityCheck.h | 24 +++++++++++++++++ 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/Marlin/src/HAL/AVR/inc/SanityCheck.h b/Marlin/src/HAL/AVR/inc/SanityCheck.h index 7e4a1d939b92..7936de8b9903 100644 --- a/Marlin/src/HAL/AVR/inc/SanityCheck.h +++ b/Marlin/src/HAL/AVR/inc/SanityCheck.h @@ -28,33 +28,26 @@ /** * Check for common serial pin conflicts */ -#if CONF_SERIAL_IS(0) - // D0-D1. No known conflicts. +#define CHECK_SERIAL_PIN(N) ( \ + X_STOP_PIN == N || Y_STOP_PIN == N || Z_STOP_PIN == N \ + || X_MIN_PIN == N || Y_MIN_PIN == N || Z_MIN_PIN == N \ + || X_MAX_PIN == N || Y_MAX_PIN == N || Z_MAX_PIN == N \ + || X_STEP_PIN == N || Y_STEP_PIN == N || Z_STEP_PIN == N \ + || X_DIR_PIN == N || Y_DIR_PIN == N || Z_DIR_PIN == N \ + || X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \ +) +#if CONF_SERIAL_IS(0) // D0-D1. No known conflicts. #endif -#if CONF_SERIAL_IS(1) - // D18-D19 can conflict with ... - #define CHECK_SERIAL_PIN(N) (X_STOP_PIN == N || Y_STOP_PIN == N || Z_STOP_PIN == N || Z_MIN_PIN == N || Z_MAX_PIN == N) - #if CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19) - #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board." - #endif - #undef CHECK_SERIAL_PIN +#if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19)) + #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board." #endif -#if CONF_SERIAL_IS(2) - // D16-D17 can conflict with ... - #define CHECK_SERIAL_PIN(N) (X_DIR_PIN == N || X_STEP_PIN == N || Y_DIR_PIN == N || Y_MIN_PIN == N || Y_MAX_PIN == N || Z_STEP_PIN == N) - #if CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17) - #error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board." - #endif - #undef CHECK_SERIAL_PIN +#if CONF_SERIAL_IS(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17)) + #error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board." #endif -#if CONF_SERIAL_IS(3) - // D14-D15 can conflict with ... - #define CHECK_SERIAL_PIN(N) (X_STEP_PIN == N || X_DIR_PIN == N || X_MIN_PIN == N || Y_STOP_PIN == N || Y_MIN_PIN == N || Y_MAX_PIN == N || Z_STOP_PIN == N) - #if CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15) - #error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board." - #endif - #undef CHECK_SERIAL_PIN +#if CONF_SERIAL_IS(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15)) + #error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board." #endif +#undef CHECK_SERIAL_PIN /** * Checks for FAST PWM diff --git a/Marlin/src/HAL/DUE/inc/SanityCheck.h b/Marlin/src/HAL/DUE/inc/SanityCheck.h index 75480acaf2e2..dd37a7bde183 100644 --- a/Marlin/src/HAL/DUE/inc/SanityCheck.h +++ b/Marlin/src/HAL/DUE/inc/SanityCheck.h @@ -25,6 +25,30 @@ * Test Arduino Due specific configuration values for errors at compile-time. */ +/** + * Check for common serial pin conflicts + */ +#define CHECK_SERIAL_PIN(N) ( \ + X_STOP_PIN == N || Y_STOP_PIN == N || Z_STOP_PIN == N \ + || X_MIN_PIN == N || Y_MIN_PIN == N || Z_MIN_PIN == N \ + || X_MAX_PIN == N || Y_MAX_PIN == N || Z_MAX_PIN == N \ + || X_STEP_PIN == N || Y_STEP_PIN == N || Z_STEP_PIN == N \ + || X_DIR_PIN == N || Y_DIR_PIN == N || Z_DIR_PIN == N \ + || X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \ +) +#if CONF_SERIAL_IS(0) // D0-D1. No known conflicts. +#endif +#if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19)) + #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board." +#endif +#if CONF_SERIAL_IS(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17)) + #error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board." +#endif +#if CONF_SERIAL_IS(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15)) + #error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board." +#endif +#undef CHECK_SERIAL_PIN + /** * HARDWARE VS. SOFTWARE SPI COMPATIBILITY *