Update UBL mesh boundaries to accomidate beds centered at 0, 0 (#8012)
This commit is contained in:
		| @@ -683,19 +683,71 @@ | ||||
|  | ||||
| // @section leveling | ||||
|  | ||||
| #if ENABLED(DELTA) && !defined(DELTA_PROBEABLE_RADIUS) | ||||
|   #define DELTA_PROBEABLE_RADIUS DELTA_PRINTABLE_RADIUS | ||||
| #elif IS_SCARA && !defined(SCARA_PRINTABLE_RADIUS) | ||||
|   #define SCARA_PRINTABLE_RADIUS (SCARA_LINKAGE_1 + SCARA_LINKAGE_2) | ||||
| #endif | ||||
|  | ||||
| // Default mesh area is an area with an inset margin on the print area. | ||||
| // Below are the macros that are used to define the borders for the mesh area, | ||||
| // made available here for specialized needs, ie dual extruder setup. | ||||
| #if ENABLED(MESH_BED_LEVELING) | ||||
|   #define MESH_MIN_X MESH_INSET | ||||
|   #define MESH_MAX_X (X_BED_SIZE - (MESH_INSET)) | ||||
|   #define MESH_MIN_Y MESH_INSET | ||||
|   #define MESH_MAX_Y (Y_BED_SIZE - (MESH_INSET)) | ||||
|   #if ENABLED(DELTA) | ||||
|     // Probing points may be verified at compile time within the radius | ||||
|     // using static_assert(HYPOT2(X2-X1,Y2-Y1)<=sq(DELTA_PRINTABLE_RADIUS),"bad probe point!") | ||||
|     // so that may be added to SanityCheck.h in the future. | ||||
|     #define MESH_MIN_X (X_CENTER - (DELTA_PROBEABLE_RADIUS) + MESH_INSET) | ||||
|     #define MESH_MIN_Y (Y_CENTER - (DELTA_PROBEABLE_RADIUS) + MESH_INSET) | ||||
|     #define MESH_MAX_X (X_CENTER +  DELTA_PROBEABLE_RADIUS - (MESH_INSET)) | ||||
|     #define MESH_MAX_Y (Y_CENTER +  DELTA_PROBEABLE_RADIUS - (MESH_INSET)) | ||||
|   #elif IS_SCARA | ||||
|     #define MESH_MIN_X (X_CENTER - (SCARA_PRINTABLE_RADIUS) + MESH_INSET) | ||||
|     #define MESH_MIN_Y (Y_CENTER - (SCARA_PRINTABLE_RADIUS) + MESH_INSET) | ||||
|     #define MESH_MAX_X (X_CENTER +  SCARA_PRINTABLE_RADIUS - (MESH_INSET)) | ||||
|     #define MESH_MAX_Y (Y_CENTER +  SCARA_PRINTABLE_RADIUS - (MESH_INSET)) | ||||
|   #else | ||||
|     // Boundaries for Cartesian probing based on set limits | ||||
|     #if ENABLED(BED_CENTER_AT_0_0) | ||||
|       #define MESH_MIN_X (max(MESH_INSET, 0) - (X_BED_SIZE) / 2) | ||||
|       #define MESH_MIN_Y (max(MESH_INSET, 0) - (Y_BED_SIZE) / 2) | ||||
|       #define MESH_MAX_X (min(X_BED_SIZE - (MESH_INSET), X_BED_SIZE) - (X_BED_SIZE) / 2) | ||||
|       #define MESH_MAX_Y (min(Y_BED_SIZE - (MESH_INSET), Y_BED_SIZE) - (Y_BED_SIZE) / 2) | ||||
|     #else | ||||
|       #define MESH_MIN_X (max(X_MIN_POS + MESH_INSET, 0)) | ||||
|       #define MESH_MIN_Y (max(Y_MIN_POS + MESH_INSET, 0)) | ||||
|       #define MESH_MAX_X (min(X_MAX_POS - (MESH_INSET), X_BED_SIZE)) | ||||
|       #define MESH_MAX_Y (min(Y_MAX_POS - (MESH_INSET), Y_BED_SIZE)) | ||||
|     #endif | ||||
|   #endif | ||||
| #elif ENABLED(AUTO_BED_LEVELING_UBL) | ||||
|   #define UBL_MESH_MIN_X UBL_MESH_INSET | ||||
|   #define UBL_MESH_MAX_X (X_BED_SIZE - (UBL_MESH_INSET)) | ||||
|   #define UBL_MESH_MIN_Y UBL_MESH_INSET | ||||
|   #define UBL_MESH_MAX_Y (Y_BED_SIZE - (UBL_MESH_INSET)) | ||||
|   #if ENABLED(DELTA) | ||||
|     // Probing points may be verified at compile time within the radius | ||||
|     // using static_assert(HYPOT2(X2-X1,Y2-Y1)<=sq(DELTA_PRINTABLE_RADIUS),"bad probe point!") | ||||
|     // so that may be added to SanityCheck.h in the future. | ||||
|     #define UBL_MESH_MIN_X (X_CENTER - (DELTA_PROBEABLE_RADIUS) + UBL_MESH_INSET) | ||||
|     #define UBL_MESH_MIN_Y (Y_CENTER - (DELTA_PROBEABLE_RADIUS) + UBL_MESH_INSET) | ||||
|     #define UBL_MESH_MAX_X (X_CENTER +  DELTA_PROBEABLE_RADIUS - (UBL_MESH_INSET)) | ||||
|     #define UBL_MESH_MAX_Y (Y_CENTER +  DELTA_PROBEABLE_RADIUS - (UBL_MESH_INSET)) | ||||
|   #elif IS_SCARA | ||||
|     #define UBL_MESH_MIN_X (X_CENTER - (SCARA_PRINTABLE_RADIUS) + UBL_MESH_INSET) | ||||
|     #define UBL_MESH_MIN_Y (Y_CENTER - (SCARA_PRINTABLE_RADIUS) + UBL_MESH_INSET) | ||||
|     #define UBL_MESH_MAX_X (X_CENTER +  SCARA_PRINTABLE_RADIUS - (UBL_MESH_INSET)) | ||||
|     #define UBL_MESH_MAX_Y (Y_CENTER +  SCARA_PRINTABLE_RADIUS - (UBL_MESH_INSET)) | ||||
|   #else | ||||
|     // Boundaries for Cartesian probing based on set limits | ||||
|     #if ENABLED(BED_CENTER_AT_0_0) | ||||
|       #define UBL_MESH_MIN_X (max(UBL_MESH_INSET, 0) - (X_BED_SIZE) / 2) | ||||
|       #define UBL_MESH_MIN_Y (max(UBL_MESH_INSET, 0) - (Y_BED_SIZE) / 2) | ||||
|       #define UBL_MESH_MAX_X (min(X_BED_SIZE - (UBL_MESH_INSET), X_BED_SIZE) - (X_BED_SIZE) / 2) | ||||
|       #define UBL_MESH_MAX_Y (min(Y_BED_SIZE - (UBL_MESH_INSET), Y_BED_SIZE) - (Y_BED_SIZE) / 2) | ||||
|     #else | ||||
|       #define UBL_MESH_MIN_X (max(X_MIN_POS + UBL_MESH_INSET, 0)) | ||||
|       #define UBL_MESH_MIN_Y (max(Y_MIN_POS + UBL_MESH_INSET, 0)) | ||||
|       #define UBL_MESH_MAX_X (min(X_MAX_POS - (UBL_MESH_INSET), X_BED_SIZE)) | ||||
|       #define UBL_MESH_MAX_Y (min(Y_MAX_POS - (UBL_MESH_INSET), Y_BED_SIZE)) | ||||
|     #endif | ||||
|   #endif | ||||
|  | ||||
|   // If this is defined, the currently active mesh will be saved in the | ||||
|   // current slot on M500. | ||||
|   | ||||
| @@ -673,19 +673,71 @@ | ||||
|  | ||||
| // @section leveling | ||||
|  | ||||
| #if ENABLED(DELTA) && !defined(DELTA_PROBEABLE_RADIUS) | ||||
|   #define DELTA_PROBEABLE_RADIUS DELTA_PRINTABLE_RADIUS | ||||
| #elif IS_SCARA && !defined(SCARA_PRINTABLE_RADIUS) | ||||
|   #define SCARA_PRINTABLE_RADIUS (SCARA_LINKAGE_1 + SCARA_LINKAGE_2) | ||||
| #endif | ||||
|  | ||||
| // Default mesh area is an area with an inset margin on the print area. | ||||
| // Below are the macros that are used to define the borders for the mesh area, | ||||
| // made available here for specialized needs, ie dual extruder setup. | ||||
| #if ENABLED(MESH_BED_LEVELING) | ||||
|   #define MESH_MIN_X MESH_INSET | ||||
|   #define MESH_MAX_X (X_BED_SIZE - (MESH_INSET)) | ||||
|   #define MESH_MIN_Y MESH_INSET | ||||
|   #define MESH_MAX_Y (Y_BED_SIZE - (MESH_INSET)) | ||||
|   #if ENABLED(DELTA) | ||||
|     // Probing points may be verified at compile time within the radius | ||||
|     // using static_assert(HYPOT2(X2-X1,Y2-Y1)<=sq(DELTA_PRINTABLE_RADIUS),"bad probe point!") | ||||
|     // so that may be added to SanityCheck.h in the future. | ||||
|     #define MESH_MIN_X (X_CENTER - (DELTA_PROBEABLE_RADIUS) + MESH_INSET) | ||||
|     #define MESH_MIN_Y (Y_CENTER - (DELTA_PROBEABLE_RADIUS) + MESH_INSET) | ||||
|     #define MESH_MAX_X (X_CENTER +  DELTA_PROBEABLE_RADIUS - (MESH_INSET)) | ||||
|     #define MESH_MAX_Y (Y_CENTER +  DELTA_PROBEABLE_RADIUS - (MESH_INSET)) | ||||
|   #elif IS_SCARA | ||||
|     #define MESH_MIN_X (X_CENTER - (SCARA_PRINTABLE_RADIUS) + MESH_INSET) | ||||
|     #define MESH_MIN_Y (Y_CENTER - (SCARA_PRINTABLE_RADIUS) + MESH_INSET) | ||||
|     #define MESH_MAX_X (X_CENTER +  SCARA_PRINTABLE_RADIUS - (MESH_INSET)) | ||||
|     #define MESH_MAX_Y (Y_CENTER +  SCARA_PRINTABLE_RADIUS - (MESH_INSET)) | ||||
|   #else | ||||
|     // Boundaries for Cartesian probing based on set limits | ||||
|     #if ENABLED(BED_CENTER_AT_0_0) | ||||
|       #define MESH_MIN_X (max(MESH_INSET, 0) - (X_BED_SIZE) / 2) | ||||
|       #define MESH_MIN_Y (max(MESH_INSET, 0) - (Y_BED_SIZE) / 2) | ||||
|       #define MESH_MAX_X (min(X_BED_SIZE - (MESH_INSET), X_BED_SIZE) - (X_BED_SIZE) / 2) | ||||
|       #define MESH_MAX_Y (min(Y_BED_SIZE - (MESH_INSET), Y_BED_SIZE) - (Y_BED_SIZE) / 2) | ||||
|     #else | ||||
|       #define MESH_MIN_X (max(X_MIN_POS + MESH_INSET, 0)) | ||||
|       #define MESH_MIN_Y (max(Y_MIN_POS + MESH_INSET, 0)) | ||||
|       #define MESH_MAX_X (min(X_MAX_POS - (MESH_INSET), X_BED_SIZE)) | ||||
|       #define MESH_MAX_Y (min(Y_MAX_POS - (MESH_INSET), Y_BED_SIZE)) | ||||
|     #endif | ||||
|   #endif | ||||
| #elif ENABLED(AUTO_BED_LEVELING_UBL) | ||||
|   #define UBL_MESH_MIN_X UBL_MESH_INSET | ||||
|   #define UBL_MESH_MAX_X (X_BED_SIZE - (UBL_MESH_INSET)) | ||||
|   #define UBL_MESH_MIN_Y UBL_MESH_INSET | ||||
|   #define UBL_MESH_MAX_Y (Y_BED_SIZE - (UBL_MESH_INSET)) | ||||
|   #if ENABLED(DELTA) | ||||
|     // Probing points may be verified at compile time within the radius | ||||
|     // using static_assert(HYPOT2(X2-X1,Y2-Y1)<=sq(DELTA_PRINTABLE_RADIUS),"bad probe point!") | ||||
|     // so that may be added to SanityCheck.h in the future. | ||||
|     #define UBL_MESH_MIN_X (X_CENTER - (DELTA_PROBEABLE_RADIUS) + UBL_MESH_INSET) | ||||
|     #define UBL_MESH_MIN_Y (Y_CENTER - (DELTA_PROBEABLE_RADIUS) + UBL_MESH_INSET) | ||||
|     #define UBL_MESH_MAX_X (X_CENTER +  DELTA_PROBEABLE_RADIUS - (UBL_MESH_INSET)) | ||||
|     #define UBL_MESH_MAX_Y (Y_CENTER +  DELTA_PROBEABLE_RADIUS - (UBL_MESH_INSET)) | ||||
|   #elif IS_SCARA | ||||
|     #define UBL_MESH_MIN_X (X_CENTER - (SCARA_PRINTABLE_RADIUS) + UBL_MESH_INSET) | ||||
|     #define UBL_MESH_MIN_Y (Y_CENTER - (SCARA_PRINTABLE_RADIUS) + UBL_MESH_INSET) | ||||
|     #define UBL_MESH_MAX_X (X_CENTER +  SCARA_PRINTABLE_RADIUS - (UBL_MESH_INSET)) | ||||
|     #define UBL_MESH_MAX_Y (Y_CENTER +  SCARA_PRINTABLE_RADIUS - (UBL_MESH_INSET)) | ||||
|   #else | ||||
|     // Boundaries for Cartesian probing based on set limits | ||||
|     #if ENABLED(BED_CENTER_AT_0_0) | ||||
|       #define UBL_MESH_MIN_X (max(UBL_MESH_INSET, 0) - (X_BED_SIZE) / 2) | ||||
|       #define UBL_MESH_MIN_Y (max(UBL_MESH_INSET, 0) - (Y_BED_SIZE) / 2) | ||||
|       #define UBL_MESH_MAX_X (min(X_BED_SIZE - (UBL_MESH_INSET), X_BED_SIZE) - (X_BED_SIZE) / 2) | ||||
|       #define UBL_MESH_MAX_Y (min(Y_BED_SIZE - (UBL_MESH_INSET), Y_BED_SIZE) - (Y_BED_SIZE) / 2) | ||||
|     #else | ||||
|       #define UBL_MESH_MIN_X (max(X_MIN_POS + UBL_MESH_INSET, 0)) | ||||
|       #define UBL_MESH_MIN_Y (max(Y_MIN_POS + UBL_MESH_INSET, 0)) | ||||
|       #define UBL_MESH_MAX_X (min(X_MAX_POS - (UBL_MESH_INSET), X_BED_SIZE)) | ||||
|       #define UBL_MESH_MAX_Y (min(Y_MAX_POS - (UBL_MESH_INSET), Y_BED_SIZE)) | ||||
|     #endif | ||||
|   #endif | ||||
|  | ||||
|   // If this is defined, the currently active mesh will be saved in the | ||||
|   // current slot on M500. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user