From acd76e860908bcc5987a93644c290a3d2ae76d34 Mon Sep 17 00:00:00 2001 From: Robby Candra Date: Sat, 14 Sep 2019 13:26:14 +0700 Subject: [PATCH] Allow odd mm bed sizes (#15258) --- Marlin/src/inc/Conditionals_post.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 4971a74107..55a1896092 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -66,20 +66,21 @@ #endif // Define center values for future use +#define _X_HALF_BED ((X_BED_SIZE) / 2) +#define _Y_HALF_BED ((Y_BED_SIZE) / 2) #if ENABLED(BED_CENTER_AT_0_0) #define X_CENTER 0 #define Y_CENTER 0 #else - #define X_CENTER ((X_BED_SIZE) / 2) - #define Y_CENTER ((Y_BED_SIZE) / 2) + #define X_CENTER _X_HALF_BED + #define Y_CENTER _Y_HALF_BED #endif -#define Z_CENTER ((Z_MIN_POS + Z_MAX_POS) / 2) // Get the linear boundaries of the bed -#define X_MIN_BED (X_CENTER - (X_BED_SIZE) / 2) -#define X_MAX_BED (X_CENTER + (X_BED_SIZE) / 2) -#define Y_MIN_BED (Y_CENTER - (Y_BED_SIZE) / 2) -#define Y_MAX_BED (Y_CENTER + (Y_BED_SIZE) / 2) +#define X_MIN_BED (X_CENTER - _X_HALF_BED) +#define X_MAX_BED (X_MIN_BED + X_BED_SIZE) +#define Y_MIN_BED (Y_CENTER - _Y_HALF_BED) +#define Y_MAX_BED (Y_MIN_BED + Y_BED_SIZE) /** * Dual X Carriage