Add a sanity check for valid bed size

This commit is contained in:
Scott Lahteine 2017-08-05 03:28:30 -05:00
parent a7e5c1bf19
commit b2822a59f9

View File

@ -51,7 +51,7 @@
* Warnings for old configurations * Warnings for old configurations
*/ */
#if !defined(X_BED_SIZE) || !defined(Y_BED_SIZE) #if !defined(X_BED_SIZE) || !defined(Y_BED_SIZE)
#error "X_BED_SIZE and BED_Y_SIZE are now required! Please update your configuration." #error "X_BED_SIZE and Y_BED_SIZE are now required! Please update your configuration."
#elif WATCH_TEMP_PERIOD > 500 #elif WATCH_TEMP_PERIOD > 500
#error "WATCH_TEMP_PERIOD now uses seconds instead of milliseconds." #error "WATCH_TEMP_PERIOD now uses seconds instead of milliseconds."
#elif DISABLED(THERMAL_PROTECTION_HOTENDS) && (defined(WATCH_TEMP_PERIOD) || defined(THERMAL_PROTECTION_PERIOD)) #elif DISABLED(THERMAL_PROTECTION_HOTENDS) && (defined(WATCH_TEMP_PERIOD) || defined(THERMAL_PROTECTION_PERIOD))
@ -244,6 +244,12 @@
#error "Z_DUAL_STEPPER_DRIVERS requires Z2 pins (and an extra E plug)." #error "Z_DUAL_STEPPER_DRIVERS requires Z2 pins (and an extra E plug)."
#endif #endif
/**
* Validate that the bed size fits
*/
static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
"Movement bounds ([XY]_MIN_POS, [XY]_MAX_POS) are too narrow to contain [XY]_BED_SIZE.");
/** /**
* Progress Bar * Progress Bar
*/ */