From 84470f6b2a623988824fa436ca687f8b34110604 Mon Sep 17 00:00:00 2001 From: Thomas Moore Date: Wed, 18 Oct 2017 10:03:00 -0500 Subject: [PATCH] Update UBL mesh boundaries to accomidate beds centered at 0, 0 (#8011) --- Marlin/Configuration_adv.h | 68 ++++++++++++++++--- .../AlephObjects/TAZ4/Configuration_adv.h | 68 ++++++++++++++++--- .../Anet/A6/Configuration_adv.h | 68 ++++++++++++++++--- .../Anet/A8/Configuration_adv.h | 68 ++++++++++++++++--- .../BQ/Hephestos/Configuration_adv.h | 68 ++++++++++++++++--- .../BQ/Hephestos_2/Configuration_adv.h | 68 ++++++++++++++++--- .../BQ/WITBOX/Configuration_adv.h | 68 ++++++++++++++++--- .../Cartesio/Configuration_adv.h | 68 ++++++++++++++++--- .../Creality/CR-10/Configuration_adv.h | 68 ++++++++++++++++--- .../Felix/Configuration_adv.h | 68 ++++++++++++++++--- .../Folger Tech/i3-2020/Configuration_adv.h | 68 ++++++++++++++++--- .../Infitary/i3-M508/Configuration_adv.h | 68 ++++++++++++++++--- .../Malyan/M150/Configuration_adv.h | 68 ++++++++++++++++--- .../RigidBot/Configuration_adv.h | 68 ++++++++++++++++--- .../SCARA/Configuration_adv.h | 68 ++++++++++++++++--- .../Sanguinololu/Configuration_adv.h | 68 ++++++++++++++++--- .../TinyBoy2/Configuration_adv.h | 68 ++++++++++++++++--- .../Velleman/K8200/Configuration_adv.h | 68 ++++++++++++++++--- .../Velleman/K8400/Configuration_adv.h | 68 ++++++++++++++++--- .../FLSUN/auto_calibrate/Configuration_adv.h | 68 ++++++++++++++++--- .../FLSUN/kossel_mini/Configuration_adv.h | 68 ++++++++++++++++--- .../delta/generic/Configuration_adv.h | 68 ++++++++++++++++--- .../delta/kossel_mini/Configuration_adv.h | 68 ++++++++++++++++--- .../delta/kossel_pro/Configuration_adv.h | 68 ++++++++++++++++--- .../delta/kossel_xl/Configuration_adv.h | 68 ++++++++++++++++--- .../gCreate/gMax1.5+/Configuration_adv.h | 68 ++++++++++++++++--- .../makibox/Configuration_adv.h | 68 ++++++++++++++++--- .../tvrrug/Round2/Configuration_adv.h | 68 ++++++++++++++++--- .../wt150/Configuration_adv.h | 68 ++++++++++++++++--- 29 files changed, 1740 insertions(+), 232 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 3520bd52de..ead3cf298d 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -659,19 +659,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/example_configurations/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h index 767da54bf3..7c2ca4db24 100644 --- a/Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/AlephObjects/TAZ4/Configuration_adv.h @@ -659,19 +659,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/example_configurations/Anet/A6/Configuration_adv.h b/Marlin/example_configurations/Anet/A6/Configuration_adv.h index 7e6b007849..3ccb25fca2 100644 --- a/Marlin/example_configurations/Anet/A6/Configuration_adv.h +++ b/Marlin/example_configurations/Anet/A6/Configuration_adv.h @@ -659,19 +659,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/example_configurations/Anet/A8/Configuration_adv.h b/Marlin/example_configurations/Anet/A8/Configuration_adv.h index 5dfe6bc7b8..e29c3d1ada 100644 --- a/Marlin/example_configurations/Anet/A8/Configuration_adv.h +++ b/Marlin/example_configurations/Anet/A8/Configuration_adv.h @@ -659,19 +659,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/example_configurations/BQ/Hephestos/Configuration_adv.h b/Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h index e33564cfff..fcb13988a8 100644 --- a/Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/BQ/Hephestos/Configuration_adv.h @@ -659,19 +659,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/example_configurations/BQ/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h index 4e45995ba8..a08dde0640 100644 --- a/Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/BQ/Hephestos_2/Configuration_adv.h @@ -656,19 +656,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/example_configurations/BQ/WITBOX/Configuration_adv.h b/Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h index e33564cfff..fcb13988a8 100644 --- a/Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/BQ/WITBOX/Configuration_adv.h @@ -659,19 +659,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/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h index db913fdb3b..2cff3ea7c0 100644 --- a/Marlin/example_configurations/Cartesio/Configuration_adv.h +++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h @@ -659,19 +659,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/example_configurations/Creality/CR-10/Configuration_adv.h b/Marlin/example_configurations/Creality/CR-10/Configuration_adv.h index 04bb514b06..0d5d71f732 100755 --- a/Marlin/example_configurations/Creality/CR-10/Configuration_adv.h +++ b/Marlin/example_configurations/Creality/CR-10/Configuration_adv.h @@ -659,19 +659,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/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index f1de982031..9fe995f165 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -659,19 +659,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/example_configurations/Folger Tech/i3-2020/Configuration_adv.h b/Marlin/example_configurations/Folger Tech/i3-2020/Configuration_adv.h index 377af558fa..c12dd203de 100644 --- a/Marlin/example_configurations/Folger Tech/i3-2020/Configuration_adv.h +++ b/Marlin/example_configurations/Folger Tech/i3-2020/Configuration_adv.h @@ -659,19 +659,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/example_configurations/Infitary/i3-M508/Configuration_adv.h b/Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h index 7c52530025..d802e208e5 100644 --- a/Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h +++ b/Marlin/example_configurations/Infitary/i3-M508/Configuration_adv.h @@ -659,19 +659,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/example_configurations/Malyan/M150/Configuration_adv.h b/Marlin/example_configurations/Malyan/M150/Configuration_adv.h index 3043b51ade..337b4ab739 100644 --- a/Marlin/example_configurations/Malyan/M150/Configuration_adv.h +++ b/Marlin/example_configurations/Malyan/M150/Configuration_adv.h @@ -656,19 +656,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/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index a684bd5a03..73bfa6634b 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -659,19 +659,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/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 0c7313f02e..66a9e5bf9e 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -659,19 +659,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/example_configurations/Sanguinololu/Configuration_adv.h b/Marlin/example_configurations/Sanguinololu/Configuration_adv.h index 4d90c1cbb6..4f6d2eac58 100644 --- a/Marlin/example_configurations/Sanguinololu/Configuration_adv.h +++ b/Marlin/example_configurations/Sanguinololu/Configuration_adv.h @@ -648,19 +648,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/example_configurations/TinyBoy2/Configuration_adv.h b/Marlin/example_configurations/TinyBoy2/Configuration_adv.h index d00a18a98e..b2cf69d846 100644 --- a/Marlin/example_configurations/TinyBoy2/Configuration_adv.h +++ b/Marlin/example_configurations/TinyBoy2/Configuration_adv.h @@ -659,19 +659,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/example_configurations/Velleman/K8200/Configuration_adv.h b/Marlin/example_configurations/Velleman/K8200/Configuration_adv.h index 7157ac3487..10526d4e31 100644 --- a/Marlin/example_configurations/Velleman/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/Velleman/K8200/Configuration_adv.h @@ -669,19 +669,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/example_configurations/Velleman/K8400/Configuration_adv.h b/Marlin/example_configurations/Velleman/K8400/Configuration_adv.h index 9665493848..0f1ec54f8f 100644 --- a/Marlin/example_configurations/Velleman/K8400/Configuration_adv.h +++ b/Marlin/example_configurations/Velleman/K8400/Configuration_adv.h @@ -659,19 +659,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/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h index 6d88e2fc33..52df91af97 100644 --- a/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -661,19 +661,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/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h index 50d7a361b1..5df2118811 100644 --- a/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -661,19 +661,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/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index 50d7a361b1..5df2118811 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -661,19 +661,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/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index 50d7a361b1..5df2118811 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -661,19 +661,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/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index 96f5b5f021..4efd336511 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -666,19 +666,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/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index 23f4033469..613b37119e 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -661,19 +661,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/example_configurations/gCreate/gMax1.5+/Configuration_adv.h b/Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h index e8d76745fb..ab577d65ee 100644 --- a/Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h +++ b/Marlin/example_configurations/gCreate/gMax1.5+/Configuration_adv.h @@ -659,19 +659,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/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index ab9508025c..b126f465b8 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -659,19 +659,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/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index d72cc8996e..d64db53ad0 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -659,19 +659,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/example_configurations/wt150/Configuration_adv.h b/Marlin/example_configurations/wt150/Configuration_adv.h index 096f5c66f6..17a51b0bb1 100644 --- a/Marlin/example_configurations/wt150/Configuration_adv.h +++ b/Marlin/example_configurations/wt150/Configuration_adv.h @@ -659,19 +659,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.