Skip to content

Commit

Permalink
move sanity check to HAL
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed May 12, 2022
1 parent 98800c8 commit 9ca2c4f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 33 deletions.
31 changes: 31 additions & 0 deletions Marlin/src/HAL/AVR/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
33 changes: 0 additions & 33 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 9ca2c4f

Please sign in to comment.