diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 8b4f527b1..765277d2f 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -26,6 +26,9 @@ * Test configuration values for errors at compile-time. */ +#ifndef _SANITYCHECK_H_ +#define _SANITYCHECK_H_ + /** * Require gcc 4.7 or newer (first included with Arduino 1.6.8) for C++11 features. */ @@ -254,7 +257,19 @@ /** * Serial */ -#if defined(USBCON) && ENABLED(SERIAL_XON_XOFF) +#ifndef USBCON + #if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024 + #error "SERIAL_XON_XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops." + #endif + + #if RX_BUFFER_SIZE && (RX_BUFFER_SIZE < 2 || !IS_POWER_OF_2(RX_BUFFER_SIZE)) + #error "RX_BUFFER_SIZE must be a power of 2 greater than 1." + #endif + + #if TX_BUFFER_SIZE && (TX_BUFFER_SIZE < 2 || TX_BUFFER_SIZE > 256 || !IS_POWER_OF_2(TX_BUFFER_SIZE)) + #error "TX_BUFFER_SIZE must be 0, a power of 2 greater than 1, and no greater than 256." + #endif +#elif ENABLED(SERIAL_XON_XOFF) #error "SERIAL_XON_XOFF is not supported on USB-native AVR devices." #endif @@ -355,9 +370,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, * Babystepping */ #if ENABLED(BABYSTEPPING) - #if DISABLED(ULTRA_LCD) && DISABLED(I2C_POSITION_ENCODERS) - #error "BABYSTEPPING requires an LCD controller." - #elif ENABLED(SCARA) + #if ENABLED(SCARA) #error "BABYSTEPPING is not implemented for SCARA yet." #elif ENABLED(DELTA) && ENABLED(BABYSTEP_XY) #error "BABYSTEPPING only implemented for Z axis on deltabots." @@ -595,7 +608,7 @@ static_assert(1 >= 0 #elif ENABLED(ENABLE_LEVELING_FADE_HEIGHT) && DISABLED(AUTO_BED_LEVELING_BILINEAR) && !UBL_SEGMENTED #error "ENABLE_LEVELING_FADE_HEIGHT on DELTA requires AUTO_BED_LEVELING_BILINEAR or AUTO_BED_LEVELING_UBL." #elif ENABLED(DELTA_AUTO_CALIBRATION) && !(HAS_BED_PROBE || ENABLED(ULTIPANEL)) - #error "DELTA_AUTO_CALIBRATION requires either a probe or an LCD Controller." + #error "DELTA_AUTO_CALIBRATION requires a probe or LCD Controller." #elif ABL_GRID #if (GRID_MAX_POINTS_X & 1) == 0 || (GRID_MAX_POINTS_Y & 1) == 0 #error "DELTA requires GRID_MAX_POINTS_X and GRID_MAX_POINTS_Y to be odd numbers." @@ -989,10 +1002,11 @@ static_assert(1 >= 0 #error "TEMP_SENSOR_0 is required." #endif -#if HOTENDS > 1 || ENABLED(HEATERS_PARALLEL) - #if !HAS_HEATER_1 - #error "HEATER_1_PIN not defined for this board." - #endif +// Pins are required for heaters +#if ENABLED(HEATER_0_USES_MAX6675) && !(defined(MAX6675_SS) && MAX6675_SS >= 0) + #error "MAX6675_SS (required for TEMP_SENSOR_0) not defined for this board." +#elif (HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)) && !HAS_HEATER_1 + #error "HEATER_1_PIN not defined for this board." #endif #if HOTENDS > 1 @@ -1412,23 +1426,24 @@ static_assert(1 >= 0 /** * Make sure HAVE_TMC2130 is warranted */ -#if ENABLED(HAVE_TMC2130) && !( \ - ENABLED( X_IS_TMC2130 ) \ - || ENABLED( X2_IS_TMC2130 ) \ - || ENABLED( Y_IS_TMC2130 ) \ - || ENABLED( Y2_IS_TMC2130 ) \ - || ENABLED( Z_IS_TMC2130 ) \ - || ENABLED( Z2_IS_TMC2130 ) \ - || ENABLED( E0_IS_TMC2130 ) \ - || ENABLED( E1_IS_TMC2130 ) \ - || ENABLED( E2_IS_TMC2130 ) \ - || ENABLED( E3_IS_TMC2130 ) \ - || ENABLED( E4_IS_TMC2130 ) ) - #error "HAVE_TMC2130 requires at least one TMC2130 stepper to be set." -#elif ENABLED(SENSORLESS_HOMING) && DISABLED(HAVE_TMC2130) - #error "Enable HAVE_TMC2130 to use SENSORLESS_HOMING." -#elif defined(AUTOMATIC_CURRENT_CONTROL) - #error "AUTOMATIC_CURRENT_CONTROL is now MONITOR_DRIVER_STATUS. Please update your configuration." +#if ENABLED(HAVE_TMC2130) + #if !( ENABLED( X_IS_TMC2130 ) \ + || ENABLED( X2_IS_TMC2130 ) \ + || ENABLED( Y_IS_TMC2130 ) \ + || ENABLED( Y2_IS_TMC2130 ) \ + || ENABLED( Z_IS_TMC2130 ) \ + || ENABLED( Z2_IS_TMC2130 ) \ + || ENABLED( E0_IS_TMC2130 ) \ + || ENABLED( E1_IS_TMC2130 ) \ + || ENABLED( E2_IS_TMC2130 ) \ + || ENABLED( E3_IS_TMC2130 ) \ + || ENABLED( E4_IS_TMC2130 ) ) + #error "HAVE_TMC2130 requires at least one TMC2130 stepper to be set." + #elif ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP) + #error "Enable STEALTHCHOP to use HYBRID_THRESHOLD." + #elif defined(AUTOMATIC_CURRENT_CONTROL) + #error "AUTOMATIC_CURRENT_CONTROL is now MONITOR_DRIVER_STATUS. Please update your configuration." + #endif #endif /** @@ -1581,3 +1596,5 @@ static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too m #endif #endif #endif + +#endif // _SANITYCHECK_H_