From ce62209bce9a1bd64cda1e72d5982a4ff0b593a2 Mon Sep 17 00:00:00 2001 From: ellensp Date: Wed, 3 Jun 2020 13:41:50 +1200 Subject: [PATCH] Probe margin. Bump config version (#18140) Co-authored-by: Scott Lahteine --- Marlin/Configuration.h | 4 +-- Marlin/Configuration_adv.h | 14 +++++---- Marlin/src/feature/z_stepper_align.cpp | 8 +++--- Marlin/src/inc/Conditionals_post.h | 36 +++++++++++------------ Marlin/src/inc/SanityCheck.h | 40 +++++++++++++++++++------- Marlin/src/inc/Version.h | 2 +- Marlin/src/module/delta.cpp | 2 +- Marlin/src/module/probe.h | 14 ++++----- 8 files changed, 70 insertions(+), 50 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index cb5ae0661..da61c00c1 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -36,7 +36,7 @@ * Advanced settings can be found in Configuration_adv.h * */ -#define CONFIGURATION_H_VERSION 020005 +#define CONFIGURATION_H_VERSION 020006 //=========================================================================== //============================= Getting Started ============================= @@ -976,7 +976,7 @@ // Most probes should stay away from the edges of the bed, but // with NOZZLE_AS_PROBE this can be negative for a wider probing area. -#define MIN_PROBE_EDGE 10 +#define PROBING_MARGIN 10 // X and Y axis travel speed (mm/m) between probes #define XY_PROBE_SPEED 8000 diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index ec6cb27ec..e71f4c467 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -31,7 +31,7 @@ * Basic settings can be found in Configuration.h * */ -#define CONFIGURATION_ADV_H_VERSION 020005 +#define CONFIGURATION_ADV_H_VERSION 020006 // @section temperature @@ -1589,7 +1589,9 @@ #endif /** - * Override MIN_PROBE_EDGE for each side of the build plate + * Probing Margins + * + * Override PROBING_MARGIN for each side of the build plate * Useful to get probe points to exact positions on targets or * to allow leveling to avoid plate clamps on only specific * sides of the bed. With NOZZLE_AS_PROBE negative values are @@ -1606,10 +1608,10 @@ * the probe to be unable to reach any points. */ #if PROBE_SELECTED && !IS_KINEMATIC - //#define MIN_PROBE_EDGE_LEFT MIN_PROBE_EDGE - //#define MIN_PROBE_EDGE_RIGHT MIN_PROBE_EDGE - //#define MIN_PROBE_EDGE_FRONT MIN_PROBE_EDGE - //#define MIN_PROBE_EDGE_BACK MIN_PROBE_EDGE + //#define PROBING_MARGIN_LEFT PROBING_MARGIN + //#define PROBING_MARGIN_RIGHT PROBING_MARGIN + //#define PROBING_MARGIN_FRONT PROBING_MARGIN + //#define PROBING_MARGIN_BACK PROBING_MARGIN #endif #if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) diff --git a/Marlin/src/feature/z_stepper_align.cpp b/Marlin/src/feature/z_stepper_align.cpp index 6fccff7cc..3614d6037 100644 --- a/Marlin/src/feature/z_stepper_align.cpp +++ b/Marlin/src/feature/z_stepper_align.cpp @@ -56,10 +56,10 @@ void ZStepperAlign::reset_to_default() { constexpr xyz_pos_t dpo = NOZZLE_TO_PROBE_OFFSET; - #define LTEST(N) (xy_init[N].x >= _MAX(X_MIN_BED + MIN_PROBE_EDGE_LEFT, X_MIN_POS + dpo.x) - 0.00001f) - #define RTEST(N) (xy_init[N].x <= _MIN(X_MAX_BED - MIN_PROBE_EDGE_RIGHT, X_MAX_POS + dpo.x) + 0.00001f) - #define FTEST(N) (xy_init[N].y >= _MAX(Y_MIN_BED + MIN_PROBE_EDGE_FRONT, Y_MIN_POS + dpo.y) - 0.00001f) - #define BTEST(N) (xy_init[N].y <= _MIN(Y_MAX_BED - MIN_PROBE_EDGE_BACK, Y_MAX_POS + dpo.y) + 0.00001f) + #define LTEST(N) (xy_init[N].x >= _MAX(X_MIN_BED + PROBING_MARGIN_LEFT, X_MIN_POS + dpo.x) - 0.00001f) + #define RTEST(N) (xy_init[N].x <= _MIN(X_MAX_BED - PROBING_MARGIN_RIGHT, X_MAX_POS + dpo.x) + 0.00001f) + #define FTEST(N) (xy_init[N].y >= _MAX(Y_MIN_BED + PROBING_MARGIN_FRONT, Y_MIN_POS + dpo.y) - 0.00001f) + #define BTEST(N) (xy_init[N].y <= _MIN(Y_MAX_BED - PROBING_MARGIN_BACK, Y_MAX_POS + dpo.y) + 0.00001f) static_assert(LTEST(0) && RTEST(0), "The 1st Z_STEPPER_ALIGN_XY X is unreachable with the default probe X offset."); static_assert(FTEST(0) && BTEST(0), "The 1st Z_STEPPER_ALIGN_XY Y is unreachable with the default probe Y offset."); diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 97f4d1eb8..edc981520 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2251,31 +2251,31 @@ * Bed Probing bounds */ -#ifndef MIN_PROBE_EDGE - #define MIN_PROBE_EDGE 0 +#ifndef PROBING_MARGIN + #define PROBING_MARGIN 0 #endif #if IS_KINEMATIC - #undef MIN_PROBE_EDGE_LEFT - #undef MIN_PROBE_EDGE_RIGHT - #undef MIN_PROBE_EDGE_FRONT - #undef MIN_PROBE_EDGE_BACK - #define MIN_PROBE_EDGE_LEFT 0 - #define MIN_PROBE_EDGE_RIGHT 0 - #define MIN_PROBE_EDGE_FRONT 0 - #define MIN_PROBE_EDGE_BACK 0 + #undef PROBING_MARGIN_LEFT + #undef PROBING_MARGIN_RIGHT + #undef PROBING_MARGIN_FRONT + #undef PROBING_MARGIN_BACK + #define PROBING_MARGIN_LEFT 0 + #define PROBING_MARGIN_RIGHT 0 + #define PROBING_MARGIN_FRONT 0 + #define PROBING_MARGIN_BACK 0 #else - #ifndef MIN_PROBE_EDGE_LEFT - #define MIN_PROBE_EDGE_LEFT MIN_PROBE_EDGE + #ifndef PROBING_MARGIN_LEFT + #define PROBING_MARGIN_LEFT PROBING_MARGIN #endif - #ifndef MIN_PROBE_EDGE_RIGHT - #define MIN_PROBE_EDGE_RIGHT MIN_PROBE_EDGE + #ifndef PROBING_MARGIN_RIGHT + #define PROBING_MARGIN_RIGHT PROBING_MARGIN #endif - #ifndef MIN_PROBE_EDGE_FRONT - #define MIN_PROBE_EDGE_FRONT MIN_PROBE_EDGE + #ifndef PROBING_MARGIN_FRONT + #define PROBING_MARGIN_FRONT PROBING_MARGIN #endif - #ifndef MIN_PROBE_EDGE_BACK - #define MIN_PROBE_EDGE_BACK MIN_PROBE_EDGE + #ifndef PROBING_MARGIN_BACK + #define PROBING_MARGIN_BACK PROBING_MARGIN #endif #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 905bcc0bd..e7d773911 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -283,9 +283,9 @@ #elif defined(NEOPIXEL_RGBW_LED) #error "NEOPIXEL_RGBW_LED is now NEOPIXEL_LED. Please update your configuration." #elif ENABLED(DELTA) && defined(DELTA_PROBEABLE_RADIUS) - #error "Remove DELTA_PROBEABLE_RADIUS and use MIN_PROBE_EDGE to inset the probe area instead." + #error "Remove DELTA_PROBEABLE_RADIUS and use PROBING_MARGIN to inset the probe area instead." #elif ENABLED(DELTA) && defined(DELTA_CALIBRATION_RADIUS) - #error "Remove DELTA_CALIBRATION_RADIUS and use MIN_PROBE_EDGE to inset the probe area instead." + #error "Remove DELTA_CALIBRATION_RADIUS and use PROBING_MARGIN to inset the probe area instead." #elif defined(UBL_MESH_INSET) #error "UBL_MESH_INSET is now just MESH_INSET. Please update your configuration." #elif defined(UBL_MESH_MIN_X) || defined(UBL_MESH_MIN_Y) || defined(UBL_MESH_MAX_X) || defined(UBL_MESH_MAX_Y) @@ -294,14 +294,24 @@ #error "ABL_PROBE_PT_[123]_[XY] is no longer required. Please remove it from Configuration.h." #elif defined(UBL_PROBE_PT_1_X) || defined(UBL_PROBE_PT_1_Y) || defined(UBL_PROBE_PT_2_X) || defined(UBL_PROBE_PT_2_Y) || defined(UBL_PROBE_PT_3_X) || defined(UBL_PROBE_PT_3_Y) #error "UBL_PROBE_PT_[123]_[XY] is no longer required. Please remove it from Configuration.h." +#elif defined(MIN_PROBE_EDGE) + #error "MIN_PROBE_EDGE is now called PROBING_MARGIN. Please update your configuration." +#elif defined(MIN_PROBE_EDGE_LEFT) + #error "MIN_PROBE_EDGE_LEFT is now called PROBING_MARGIN_LEFT. Please update your configuration." +#elif defined(MIN_PROBE_EDGE_RIGHT) + #error "MIN_PROBE_EDGE_RIGHT is now called PROBING_MARGIN_RIGHT. Please update your configuration." +#elif defined(MIN_PROBE_EDGE_FRONT) + #error "MIN_PROBE_EDGE_FRONT is now called PROBING_MARGIN_FRONT. Please update your configuration." +#elif defined(MIN_PROBE_EDGE_BACK) + #error "MIN_PROBE_EDGE_BACK is now called PROBING_MARGIN_BACK. Please update your configuration." #elif defined(LEFT_PROBE_BED_POSITION) - #error "LEFT_PROBE_BED_POSITION is obsolete. Set a margin with MIN_PROBE_EDGE or MIN_PROBE_EDGE_LEFT instead." + #error "LEFT_PROBE_BED_POSITION is obsolete. Set a margin with PROBING_MARGIN or PROBING_MARGIN_LEFT instead." #elif defined(RIGHT_PROBE_BED_POSITION) - #error "RIGHT_PROBE_BED_POSITION is obsolete. Set a margin with MIN_PROBE_EDGE or MIN_PROBE_EDGE_RIGHT instead." + #error "RIGHT_PROBE_BED_POSITION is obsolete. Set a margin with PROBING_MARGIN or PROBING_MARGIN_RIGHT instead." #elif defined(FRONT_PROBE_BED_POSITION) - #error "FRONT_PROBE_BED_POSITION is obsolete. Set a margin with MIN_PROBE_EDGE or MIN_PROBE_EDGE_FRONT instead." + #error "FRONT_PROBE_BED_POSITION is obsolete. Set a margin with PROBING_MARGIN or PROBING_MARGIN_FRONT instead." #elif defined(BACK_PROBE_BED_POSITION) - #error "BACK_PROBE_BED_POSITION is obsolete. Set a margin with MIN_PROBE_EDGE or MIN_PROBE_EDGE_BACK instead." + #error "BACK_PROBE_BED_POSITION is obsolete. Set a margin with PROBING_MARGIN or PROBING_MARGIN_BACK instead." #elif defined(ENABLE_MESH_EDIT_GFX_OVERLAY) #error "ENABLE_MESH_EDIT_GFX_OVERLAY is now MESH_EDIT_GFX_OVERLAY. Please update your configuration." #elif defined(BABYSTEP_ZPROBE_GFX_REVERSE) @@ -1263,13 +1273,21 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif #if DISABLED(NOZZLE_AS_PROBE) - static_assert(MIN_PROBE_EDGE >= 0, "MIN_PROBE_EDGE must be >= 0."); - static_assert(MIN_PROBE_EDGE_BACK >= 0, "MIN_PROBE_EDGE_BACK must be >= 0."); - static_assert(MIN_PROBE_EDGE_FRONT >= 0, "MIN_PROBE_EDGE_FRONT must be >= 0."); - static_assert(MIN_PROBE_EDGE_LEFT >= 0, "MIN_PROBE_EDGE_LEFT must be >= 0."); - static_assert(MIN_PROBE_EDGE_RIGHT >= 0, "MIN_PROBE_EDGE_RIGHT must be >= 0."); + static_assert(PROBING_MARGIN >= 0, "PROBING_MARGIN must be >= 0."); + static_assert(PROBING_MARGIN_BACK >= 0, "PROBING_MARGIN_BACK must be >= 0."); + static_assert(PROBING_MARGIN_FRONT >= 0, "PROBING_MARGIN_FRONT must be >= 0."); + static_assert(PROBING_MARGIN_LEFT >= 0, "PROBING_MARGIN_LEFT must be >= 0."); + static_assert(PROBING_MARGIN_RIGHT >= 0, "PROBING_MARGIN_RIGHT must be >= 0."); #endif + #define _MARGIN(A) TERN(IS_SCARA, SCARA_PRINTABLE_RADIUS, TERN(DELTA, DELTA_PRINTABLE_RADIUS, A##_CENTER)) + static_assert(PROBING_MARGIN < _MARGIN(X), "PROBING_MARGIN is too large."); + static_assert(PROBING_MARGIN_BACK < _MARGIN(Y), "PROBING_MARGIN_BACK is too large."); + static_assert(PROBING_MARGIN_FRONT < _MARGIN(Y), "PROBING_MARGIN_FRONT is too large."); + static_assert(PROBING_MARGIN_LEFT < _MARGIN(X), "PROBING_MARGIN_LEFT is too large."); + static_assert(PROBING_MARGIN_RIGHT < _MARGIN(X), "PROBING_MARGIN_RIGHT is too large."); + #undef _MARGIN + /** * Make sure Z raise values are set */ diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index ae8e5cf24..4a3af243f 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -52,7 +52,7 @@ * to alert users to major changes. */ -#define MARLIN_HEX_VERSION 020005 +#define MARLIN_HEX_VERSION 020006 #ifndef REQUIRED_CONFIGURATION_H_VERSION #define REQUIRED_CONFIGURATION_H_VERSION MARLIN_HEX_VERSION #endif diff --git a/Marlin/src/module/delta.cpp b/Marlin/src/module/delta.cpp index a91a8e854..56b9e0a11 100644 --- a/Marlin/src/module/delta.cpp +++ b/Marlin/src/module/delta.cpp @@ -95,7 +95,7 @@ void recalc_delta_settings() { float delta_calibration_radius() { return calibration_radius_factor * ( #if HAS_BED_PROBE - FLOOR((DELTA_PRINTABLE_RADIUS) - _MAX(HYPOT(probe.offset_xy.x, probe.offset_xy.y), MIN_PROBE_EDGE)) + FLOOR((DELTA_PRINTABLE_RADIUS) - _MAX(HYPOT(probe.offset_xy.x, probe.offset_xy.y), PROBING_MARGIN)) #else DELTA_PRINTABLE_RADIUS #endif diff --git a/Marlin/src/module/probe.h b/Marlin/src/module/probe.h index 7b920ab82..0f8ce4a35 100644 --- a/Marlin/src/module/probe.h +++ b/Marlin/src/module/probe.h @@ -54,11 +54,11 @@ public: // Note: This won't work on SCARA since the probe offset rotates with the arm. static inline bool can_reach(const float &rx, const float &ry) { return position_is_reachable(rx - offset_xy.x, ry - offset_xy.y) // The nozzle can go where it needs to go? - && position_is_reachable(rx, ry, ABS(MIN_PROBE_EDGE)); // Can the nozzle also go near there? + && position_is_reachable(rx, ry, ABS(PROBING_MARGIN)); // Can the nozzle also go near there? } #else FORCE_INLINE static bool can_reach(const float &rx, const float &ry) { - return position_is_reachable(rx, ry, MIN_PROBE_EDGE); + return position_is_reachable(rx, ry, PROBING_MARGIN); } #endif @@ -131,7 +131,7 @@ public: ); static inline float probe_radius() { - return printable_radius - _MAX(MIN_PROBE_EDGE, HYPOT(offset_xy.x, offset_xy.y)); + return printable_radius - _MAX(PROBING_MARGIN, HYPOT(offset_xy.x, offset_xy.y)); } #endif @@ -140,7 +140,7 @@ public: #if IS_KINEMATIC (X_CENTER) - probe_radius() #else - _MAX((X_MIN_BED) + (MIN_PROBE_EDGE_LEFT), (X_MIN_POS) + offset_xy.x) + _MAX((X_MIN_BED) + (PROBING_MARGIN_LEFT), (X_MIN_POS) + offset_xy.x) #endif ); } @@ -149,7 +149,7 @@ public: #if IS_KINEMATIC (X_CENTER) + probe_radius() #else - _MIN((X_MAX_BED) - (MIN_PROBE_EDGE_RIGHT), (X_MAX_POS) + offset_xy.x) + _MIN((X_MAX_BED) - (PROBING_MARGIN_RIGHT), (X_MAX_POS) + offset_xy.x) #endif ); } @@ -158,7 +158,7 @@ public: #if IS_KINEMATIC (Y_CENTER) - probe_radius() #else - _MAX((Y_MIN_BED) + (MIN_PROBE_EDGE_FRONT), (Y_MIN_POS) + offset_xy.y) + _MAX((Y_MIN_BED) + (PROBING_MARGIN_FRONT), (Y_MIN_POS) + offset_xy.y) #endif ); } @@ -167,7 +167,7 @@ public: #if IS_KINEMATIC (Y_CENTER) + probe_radius() #else - _MIN((Y_MAX_BED) - (MIN_PROBE_EDGE_BACK), (Y_MAX_POS) + offset_xy.y) + _MIN((Y_MAX_BED) - (PROBING_MARGIN_BACK), (Y_MAX_POS) + offset_xy.y) #endif ); }