From 21e60fd3edd9ea009f1a86db5c06909d59ff1cd0 Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Thu, 15 Feb 2018 15:07:42 -0600 Subject: [PATCH] Allow user to control Z-Height correction for off mesh movements (#9661) --- Marlin/Configuration.h | 2 ++ Marlin/src/config/default/Configuration.h | 3 ++ .../AlephObjects/TAZ4/Configuration.h | 3 ++ .../AliExpress/CL-260/Configuration.h | 3 ++ .../config/examples/Anet/A6/Configuration.h | 3 ++ .../config/examples/Anet/A8/Configuration.h | 3 ++ .../examples/Azteeg/X5GT/Configuration.h | 3 ++ .../BIBO/TouchX/cyclops/Configuration.h | 3 ++ .../BIBO/TouchX/default/Configuration.h | 3 ++ .../examples/BQ/Hephestos/Configuration.h | 3 ++ .../examples/BQ/Hephestos_2/Configuration.h | 3 ++ .../config/examples/BQ/WITBOX/Configuration.h | 3 ++ .../config/examples/Cartesio/Configuration.h | 3 ++ .../examples/Creality/CR-10/Configuration.h | 3 ++ .../examples/Creality/CR-10S/Configuration.h | 3 ++ .../src/config/examples/Felix/Configuration.h | 3 ++ .../examples/Felix/DUAL/Configuration.h | 3 ++ .../FolgerTech/i3-2020/Configuration.h | 3 ++ .../examples/Geeetech/GT2560/Configuration.h | 3 ++ .../Geeetech/I3_Pro_X-GT2560/Configuration.h | 3 ++ .../examples/Infitary/i3-M508/Configuration.h | 3 ++ .../examples/JGAurora/A5/Configuration.h | 3 ++ .../examples/MakerParts/Configuration.h | 3 ++ .../examples/Malyan/M150/Configuration.h | 3 ++ .../examples/Malyan/M200/Configuration.h | 3 ++ .../Micromake/C1/basic/Configuration.h | 3 ++ .../Micromake/C1/enhanced/Configuration.h | 3 ++ .../config/examples/Mks/Sbase/Configuration.h | 3 ++ .../RepRapWorld/Megatronics/Configuration.h | 3 ++ .../config/examples/RigidBot/Configuration.h | 3 ++ .../src/config/examples/SCARA/Configuration.h | 3 ++ .../config/examples/STM32F10/Configuration.h | 3 ++ .../examples/Sanguinololu/Configuration.h | 3 ++ .../config/examples/TheBorg/Configuration.h | 3 ++ .../config/examples/TinyBoy2/Configuration.h | 3 ++ .../config/examples/Tronxy/X1/Configuration.h | 3 ++ .../examples/Tronxy/X5S/Configuration.h | 3 ++ .../UltiMachine/Archim2/Configuration.h | 3 ++ .../examples/Velleman/K8200/Configuration.h | 3 ++ .../examples/Velleman/K8400/Configuration.h | 3 ++ .../Velleman/K8400/Dual-head/Configuration.h | 3 ++ .../examples/adafruit/ST7565/Configuration.h | 3 ++ .../FLSUN/auto_calibrate/Configuration.h | 3 ++ .../delta/FLSUN/kossel/Configuration.h | 3 ++ .../delta/FLSUN/kossel_mini/Configuration.h | 3 ++ .../examples/delta/generic/Configuration.h | 3 ++ .../delta/kossel_mini/Configuration.h | 3 ++ .../examples/delta/kossel_pro/Configuration.h | 3 ++ .../examples/delta/kossel_xl/Configuration.h | 3 ++ .../examples/gCreate/gMax1.5+/Configuration.h | 3 ++ .../config/examples/makibox/Configuration.h | 3 ++ .../examples/stm32f103ret6/Configuration.h | 3 ++ .../examples/tvrrug/Round2/Configuration.h | 3 ++ .../src/config/examples/wt150/Configuration.h | 3 ++ Marlin/src/feature/bedlevel/ubl/ubl.h | 31 +++++++++++++++++-- .../src/feature/bedlevel/ubl/ubl_motion.cpp | 9 ++++-- 56 files changed, 197 insertions(+), 4 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 08c414821..6eabaec85 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -999,6 +999,8 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/default/Configuration.h b/Marlin/src/config/default/Configuration.h index 08c414821..906765503 100644 --- a/Marlin/src/config/default/Configuration.h +++ b/Marlin/src/config/default/Configuration.h @@ -999,6 +999,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h index 443ea8645..bbf0174cb 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h @@ -1019,6 +1019,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h index bd4b02bc5..629a2373a 100644 --- a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h +++ b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h @@ -999,6 +999,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Anet/A6/Configuration.h b/Marlin/src/config/examples/Anet/A6/Configuration.h index f2a3df5d7..2a4365b24 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration.h @@ -1133,6 +1133,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Anet/A8/Configuration.h b/Marlin/src/config/examples/Anet/A8/Configuration.h index dbcf8ba0b..21f94a4ae 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration.h @@ -1006,6 +1006,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h b/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h index 635479283..52e66bdc2 100644 --- a/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h +++ b/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h @@ -999,6 +999,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h index 4a323e80e..b8712d93e 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h +++ b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h @@ -999,6 +999,9 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h index 73a0ed8d7..0c3da3940 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h +++ b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h @@ -999,6 +999,9 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration.h index ec5a55a40..4cd46632b 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration.h @@ -987,6 +987,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h index ac5c7f348..548fb91f5 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h +++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h @@ -1000,6 +1000,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration.h index b6ec78769..b1c2d0d8b 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration.h @@ -987,6 +987,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Cartesio/Configuration.h b/Marlin/src/config/examples/Cartesio/Configuration.h index db6f60266..0f2e7a3ad 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration.h +++ b/Marlin/src/config/examples/Cartesio/Configuration.h @@ -998,6 +998,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration.h b/Marlin/src/config/examples/Creality/CR-10/Configuration.h index 584dd627c..a7694d926 100755 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration.h @@ -1002,6 +1002,9 @@ #define UBL_PROBE_PT_1_X 39 // Probing points for 3-Point leveling of the mesh #define UBL_PROBE_PT_1_Y 180 #define UBL_PROBE_PT_2_X 39 + + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. #define UBL_PROBE_PT_2_Y 20 #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 diff --git a/Marlin/src/config/examples/Creality/CR-10S/Configuration.h b/Marlin/src/config/examples/Creality/CR-10S/Configuration.h index b8a72bef8..aa846fa80 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/Configuration.h +++ b/Marlin/src/config/examples/Creality/CR-10S/Configuration.h @@ -991,6 +991,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Felix/Configuration.h b/Marlin/src/config/examples/Felix/Configuration.h index 5278b2188..ebdd8aa22 100644 --- a/Marlin/src/config/examples/Felix/Configuration.h +++ b/Marlin/src/config/examples/Felix/Configuration.h @@ -981,6 +981,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Felix/DUAL/Configuration.h b/Marlin/src/config/examples/Felix/DUAL/Configuration.h index a3663b823..05179bb0c 100644 --- a/Marlin/src/config/examples/Felix/DUAL/Configuration.h +++ b/Marlin/src/config/examples/Felix/DUAL/Configuration.h @@ -981,6 +981,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h index 113a3b653..35f1f8585 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h @@ -1005,6 +1005,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + #define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h b/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h index ed7466da0..afac31e5f 100644 --- a/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h @@ -1014,6 +1014,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h b/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h index 35bf81dfc..5202fa01c 100644 --- a/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h @@ -999,6 +999,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h index bdbdd76b2..555e22fe1 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h @@ -1003,6 +1003,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/JGAurora/A5/Configuration.h b/Marlin/src/config/examples/JGAurora/A5/Configuration.h index dd077bc0c..077733ca9 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration.h +++ b/Marlin/src/config/examples/JGAurora/A5/Configuration.h @@ -1011,6 +1011,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/MakerParts/Configuration.h b/Marlin/src/config/examples/MakerParts/Configuration.h index 75cd38829..f37476dbe 100644 --- a/Marlin/src/config/examples/MakerParts/Configuration.h +++ b/Marlin/src/config/examples/MakerParts/Configuration.h @@ -1019,6 +1019,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration.h b/Marlin/src/config/examples/Malyan/M150/Configuration.h index e22748558..e6a2e35d9 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration.h +++ b/Marlin/src/config/examples/Malyan/M150/Configuration.h @@ -1027,6 +1027,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration.h b/Marlin/src/config/examples/Malyan/M200/Configuration.h index c1d508ac9..6a2e6a0a8 100644 --- a/Marlin/src/config/examples/Malyan/M200/Configuration.h +++ b/Marlin/src/config/examples/Malyan/M200/Configuration.h @@ -998,6 +998,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h b/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h index 554a06590..d85e0aa30 100644 --- a/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h +++ b/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h @@ -1003,6 +1003,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h index 470209cbf..afbfc8832 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h +++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h @@ -1003,6 +1003,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration.h b/Marlin/src/config/examples/Mks/Sbase/Configuration.h index 8a04371d9..fcad29805 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration.h @@ -999,6 +999,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h b/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h index 320201395..e065e0f2d 100644 --- a/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h @@ -999,6 +999,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/RigidBot/Configuration.h b/Marlin/src/config/examples/RigidBot/Configuration.h index 59da245b6..376c94977 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration.h +++ b/Marlin/src/config/examples/RigidBot/Configuration.h @@ -997,6 +997,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/SCARA/Configuration.h b/Marlin/src/config/examples/SCARA/Configuration.h index 7d4091b1e..617ecb5b9 100644 --- a/Marlin/src/config/examples/SCARA/Configuration.h +++ b/Marlin/src/config/examples/SCARA/Configuration.h @@ -1011,6 +1011,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/STM32F10/Configuration.h b/Marlin/src/config/examples/STM32F10/Configuration.h index e2ca0ccc4..affc79667 100644 --- a/Marlin/src/config/examples/STM32F10/Configuration.h +++ b/Marlin/src/config/examples/STM32F10/Configuration.h @@ -1002,6 +1002,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration.h b/Marlin/src/config/examples/Sanguinololu/Configuration.h index b26b6adc4..239cf8d65 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration.h @@ -1030,6 +1030,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/TheBorg/Configuration.h b/Marlin/src/config/examples/TheBorg/Configuration.h index b4b25d54d..8ade00345 100644 --- a/Marlin/src/config/examples/TheBorg/Configuration.h +++ b/Marlin/src/config/examples/TheBorg/Configuration.h @@ -999,6 +999,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration.h b/Marlin/src/config/examples/TinyBoy2/Configuration.h index 0378ed8f4..a858ab9c2 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration.h @@ -1055,6 +1055,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Tronxy/X1/Configuration.h b/Marlin/src/config/examples/Tronxy/X1/Configuration.h index 982bd2ff9..e74543b69 100644 --- a/Marlin/src/config/examples/Tronxy/X1/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/X1/Configuration.h @@ -990,6 +990,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h b/Marlin/src/config/examples/Tronxy/X5S/Configuration.h index 86dd52dff..38a6a31d1 100644 --- a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/X5S/Configuration.h @@ -999,6 +999,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h index 177ec121b..af734b063 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h +++ b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h @@ -990,6 +990,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration.h b/Marlin/src/config/examples/Velleman/K8200/Configuration.h index ce3dbe7b0..ecc36d717 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration.h @@ -1029,6 +1029,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration.h b/Marlin/src/config/examples/Velleman/K8400/Configuration.h index 3841350fa..5e6092b26 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration.h @@ -999,6 +999,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h index 5bc9aa88d..2e0c436c2 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h @@ -999,6 +999,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/adafruit/ST7565/Configuration.h b/Marlin/src/config/examples/adafruit/ST7565/Configuration.h index b822d6c36..fb48c5ba5 100644 --- a/Marlin/src/config/examples/adafruit/ST7565/Configuration.h +++ b/Marlin/src/config/examples/adafruit/ST7565/Configuration.h @@ -999,6 +999,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h index 0fa3f617b..7ab6cb2e9 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h @@ -1133,6 +1133,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h index b81aa9b8e..99e455f7b 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h @@ -1124,6 +1124,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h index 68ae49633..787212c40 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h @@ -1132,6 +1132,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/delta/generic/Configuration.h b/Marlin/src/config/examples/delta/generic/Configuration.h index 274b716e0..c67f53f39 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration.h +++ b/Marlin/src/config/examples/delta/generic/Configuration.h @@ -1121,6 +1121,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h index e882dcffe..6ebfebf86 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h @@ -1124,6 +1124,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/delta/kossel_pro/Configuration.h b/Marlin/src/config/examples/delta/kossel_pro/Configuration.h index 305df1978..f9e738e40 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_pro/Configuration.h @@ -1124,6 +1124,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration.h index bdf931720..4ed978125 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration.h @@ -1133,6 +1133,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h index e6e46ed4c..9053afb07 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h @@ -1013,6 +1013,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/makibox/Configuration.h b/Marlin/src/config/examples/makibox/Configuration.h index cb9675b1a..d063628ea 100644 --- a/Marlin/src/config/examples/makibox/Configuration.h +++ b/Marlin/src/config/examples/makibox/Configuration.h @@ -1002,6 +1002,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/stm32f103ret6/Configuration.h b/Marlin/src/config/examples/stm32f103ret6/Configuration.h index cb99eb4e8..cde085afb 100644 --- a/Marlin/src/config/examples/stm32f103ret6/Configuration.h +++ b/Marlin/src/config/examples/stm32f103ret6/Configuration.h @@ -1000,6 +1000,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration.h index c1c3b2577..07d0dcd91 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration.h @@ -994,6 +994,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/config/examples/wt150/Configuration.h b/Marlin/src/config/examples/wt150/Configuration.h index 7594dd70f..3520789b1 100644 --- a/Marlin/src/config/examples/wt150/Configuration.h +++ b/Marlin/src/config/examples/wt150/Configuration.h @@ -1004,6 +1004,9 @@ #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 + //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used + // as the Z-Height correction value. + #elif ENABLED(MESH_BED_LEVELING) //=========================================================================== diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index 090641a05..bc4df7f44 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -223,7 +223,16 @@ class unified_bed_leveling { SERIAL_EOL(); } #endif - return NAN; + + /** + * The requested location is off the mesh. Check if UBL_Z_RAISE_WHEN_OFF_MESH + * is specified. If so, that value is returned. + */ + #if ENABLED(UBL_Z_RAISE_WHEN_OFF_MESH) + return UBL_Z_RAISE_WHEN_OFF_MESH; + #else + return NAN; + #endif } const float xratio = (rx0 - mesh_index_to_xpos(x1_i)) * (1.0 / (MESH_X_DIST)), @@ -249,7 +258,16 @@ class unified_bed_leveling { SERIAL_EOL(); } #endif - return NAN; + + /** + * The requested location is off the mesh. Check if UBL_Z_RAISE_WHEN_OFF_MESH + * is specified. If so, that value is returned. + */ + #if ENABLED(UBL_Z_RAISE_WHEN_OFF_MESH) + return UBL_Z_RAISE_WHEN_OFF_MESH; + #else + return NAN; + #endif } const float yratio = (ry0 - mesh_index_to_ypos(y1_i)) * (1.0 / (MESH_Y_DIST)), @@ -270,6 +288,15 @@ class unified_bed_leveling { const int8_t cx = get_cell_index_x(rx0), cy = get_cell_index_y(ry0); // return values are clamped + /** + * Check if the requested location is off the mesh. If so, and + * UBL_Z_RAISE_WHEN_OFF_MESH is specified, that value is returned. + */ + #if ENABLED(UBL_Z_RAISE_WHEN_OFF_MESH) + if (!WITHIN(rx0, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(ry0, 0, GRID_MAX_POINTS_Y - 1)) + return UBL_Z_RAISE_WHEN_OFF_MESHH; + #endif + const float z1 = calc_z0(rx0, mesh_index_to_xpos(cx), z_values[cx][cy], mesh_index_to_xpos(cx + 1), z_values[min(cx, GRID_MAX_POINTS_X - 2) + 1][cy]); diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp index 07d541233..c265e4ade 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp @@ -86,9 +86,14 @@ if (!WITHIN(cell_dest_xi, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(cell_dest_yi, 0, GRID_MAX_POINTS_Y - 1)) { // Note: There is no Z Correction in this case. We are off the grid and don't know what - // a reasonable correction would be. + // a reasonable correction would be. If the user has specified a UBL_Z_RAISE_WHEN_OFF_MESH + // value, that will be used instead of a calculated (Bi-Linear interpolation) correction. - planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS], end[E_AXIS], feed_rate, extruder); + float z_raise = 0.0; + #if ENABLED(UBL_Z_RAISE_WHEN_OFF_MESH) + z_raise = UBL_Z_RAISE_WHEN_OFF_MESH; + #endif + planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + z_raise, end[E_AXIS], feed_rate, extruder); set_current_from_destination(); if (g26_debug_flag)