diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 4a86aa816..25048f304 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -674,19 +674,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. diff --git a/Marlin/src/config/default/Configuration_adv.h b/Marlin/src/config/default/Configuration_adv.h index 4a86aa816..25048f304 100644 --- a/Marlin/src/config/default/Configuration_adv.h +++ b/Marlin/src/config/default/Configuration_adv.h @@ -674,19 +674,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. diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h index 2641a47ed..bdca7c3bd 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h index d46d02427..f1e61eb7c 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h index 2d49bf935..6f84d700c 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h index 9c83019b5..882995f09 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h index 468b11180..108d09196 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h @@ -670,19 +670,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. diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h index 9c83019b5..882995f09 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/Cartesio/Configuration_adv.h b/Marlin/src/config/examples/Cartesio/Configuration_adv.h index 5c4258ffc..cda6da772 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration_adv.h +++ b/Marlin/src/config/examples/Cartesio/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h index 9db1c5dec..72605e8a4 100644 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/Felix/Configuration_adv.h b/Marlin/src/config/examples/Felix/Configuration_adv.h index 0e69ced07..b5b21c341 100644 --- a/Marlin/src/config/examples/Felix/Configuration_adv.h +++ b/Marlin/src/config/examples/Felix/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h b/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h index 3a4f39e6e..1119045dc 100644 --- a/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h +++ b/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h @@ -674,19 +674,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. diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h index 46328cb5c..ddebb35eb 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h index 40c37d358..cc9a5242a 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h @@ -670,19 +670,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. diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h index f4123c704..832dc4943 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h @@ -694,19 +694,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. diff --git a/Marlin/src/config/examples/RigidBot/Configuration_adv.h b/Marlin/src/config/examples/RigidBot/Configuration_adv.h index ea64ce793..d7e5078fb 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration_adv.h +++ b/Marlin/src/config/examples/RigidBot/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/SCARA/Configuration_adv.h b/Marlin/src/config/examples/SCARA/Configuration_adv.h index 01e1eaafb..42269860f 100644 --- a/Marlin/src/config/examples/SCARA/Configuration_adv.h +++ b/Marlin/src/config/examples/SCARA/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h index 3b26cd6f1..981d67c9a 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h @@ -662,19 +662,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. diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h index 7a1c1376a..f98f847be 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h index 95914697c..e9348dfc3 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h index d8f7e8546..17a73a6ee 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h index 40dc3cfb1..65dead1a8 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -675,19 +675,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. diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h index b6f763372..84e999860 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -675,19 +675,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. diff --git a/Marlin/src/config/examples/delta/generic/Configuration_adv.h b/Marlin/src/config/examples/delta/generic/Configuration_adv.h index b6f763372..84e999860 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/generic/Configuration_adv.h @@ -675,19 +675,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. diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h index b6f763372..84e999860 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h @@ -675,19 +675,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. diff --git a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h index f7e7c6c87..fb92763fc 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h @@ -680,19 +680,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. diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h index 92388876d..b72d5d3fd 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h @@ -675,19 +675,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. diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h index 905f45d6d..19c88458e 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/makibox/Configuration_adv.h b/Marlin/src/config/examples/makibox/Configuration_adv.h index f73b79e81..1d40e2d13 100644 --- a/Marlin/src/config/examples/makibox/Configuration_adv.h +++ b/Marlin/src/config/examples/makibox/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h index a23689091..b6630e7cb 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h @@ -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. diff --git a/Marlin/src/config/examples/wt150/Configuration_adv.h b/Marlin/src/config/examples/wt150/Configuration_adv.h index 581e695ca..fdec2631c 100644 --- a/Marlin/src/config/examples/wt150/Configuration_adv.h +++ b/Marlin/src/config/examples/wt150/Configuration_adv.h @@ -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.