From 82f3688955dc323d84b6b36e53eb1f5a83422f46 Mon Sep 17 00:00:00 2001 From: Kit Adams Date: Mon, 7 Jan 2019 15:39:58 +1300 Subject: [PATCH 1/7] Account for x and y probe offset when indicating current position on grid when displaying mesh map. --- Marlin/ubl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Marlin/ubl.cpp b/Marlin/ubl.cpp index 26485c5d02bc..c64c249fa2ee 100644 --- a/Marlin/ubl.cpp +++ b/Marlin/ubl.cpp @@ -210,8 +210,11 @@ serialprintPGM(csv ? PSTR("CSV:\n") : PSTR("LCD:\n")); } - const float current_xi = get_cell_index_x(current_position[X_AXIS] + (MESH_X_DIST) / 2.0), - current_yi = get_cell_index_y(current_position[Y_AXIS] + (MESH_Y_DIST) / 2.0); +//Add XY_PROBE_OFFSET_FROM_EXTRUDER because probe_pt() subtracted these when +//moving to the xy position to be measured. This ensures better agreement between +//the current z position after G28 and the mesh values. + const float current_xi = find_closest_x_index(current_position[X_AXIS]+X_PROBE_OFFSET_FROM_EXTRUDER), + current_yi = find_closest_y_index(current_position[Y_AXIS]+Y_PROBE_OFFSET_FROM_EXTRUDER); if (!lcd) SERIAL_EOL(); for (int8_t j = GRID_MAX_POINTS_Y - 1; j >= 0; j--) { From 75a220a065c8d6fa74e809c8c9f845a0dc872c5e Mon Sep 17 00:00:00 2001 From: Kit Adams Date: Mon, 7 Jan 2019 18:05:49 +1300 Subject: [PATCH 2/7] Try to home on a grid point to better allow checking mesh center --- Marlin/Configuration.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 2e95701c2de3..e2f06a979398 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1144,8 +1144,14 @@ //#define Z_SAFE_HOMING #if ENABLED(Z_SAFE_HOMING) - #define Z_SAFE_HOMING_X_POINT ((X_BED_SIZE) / 2) // X point for Z homing when homing all axes (G28). - #define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE) / 2) // Y point for Z homing when homing all axes (G28). + #if ENABLED(AUTO_BED_LEVELING_UBL) + //Try to home on a grid point to better allow checking mesh center + #define Z_SAFE_HOMING_X_POINT ((GRID_MAX_POINTS_X/2)*(X_BED_SIZE-2*MESH_INSET)/(GRID_MAX_POINTS_X-1)+MESH_INSET) // X point for Z homing when homing all axes (G28). + #define Z_SAFE_HOMING_Y_POINT ((GRID_MAX_POINTS_Y/2)*(Y_BED_SIZE-2*MESH_INSET)/(GRID_MAX_POINTS_Y-1)+MESH_INSET) // Y point for Z homing when homing all axes (G28). + #else + #define Z_SAFE_HOMING_X_POINT ((X_BED_SIZE) / 2) // X point for Z homing when homing all axes (G28). + #define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE) / 2) // Y point for Z homing when homing all axes (G28). + #endif #endif // Homing speeds (mm/m) From 2a380620de8c39bdb07b1e122faa5d966a7fc9da Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 7 Jan 2019 08:14:29 -0600 Subject: [PATCH 3/7] Update ubl.cpp --- Marlin/ubl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/ubl.cpp b/Marlin/ubl.cpp index c64c249fa2ee..d67149368bff 100644 --- a/Marlin/ubl.cpp +++ b/Marlin/ubl.cpp @@ -210,9 +210,9 @@ serialprintPGM(csv ? PSTR("CSV:\n") : PSTR("LCD:\n")); } -//Add XY_PROBE_OFFSET_FROM_EXTRUDER because probe_pt() subtracted these when -//moving to the xy position to be measured. This ensures better agreement between -//the current z position after G28 and the mesh values. + // Add XY_PROBE_OFFSET_FROM_EXTRUDER because probe_pt() subtracts these when + // moving to the xy position to be measured. This ensures better agreement between + // the current Z position after G28 and the mesh values. const float current_xi = find_closest_x_index(current_position[X_AXIS]+X_PROBE_OFFSET_FROM_EXTRUDER), current_yi = find_closest_y_index(current_position[Y_AXIS]+Y_PROBE_OFFSET_FROM_EXTRUDER); From 8b422f93efc4924c465c2d442eb060bbbfb64e8c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 7 Jan 2019 08:14:54 -0600 Subject: [PATCH 4/7] Update Configuration.h --- Marlin/Configuration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index e2f06a979398..a2f0aa7b5c1a 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1145,7 +1145,7 @@ #if ENABLED(Z_SAFE_HOMING) #if ENABLED(AUTO_BED_LEVELING_UBL) - //Try to home on a grid point to better allow checking mesh center + // Try to home on a grid point to better allow checking mesh center #define Z_SAFE_HOMING_X_POINT ((GRID_MAX_POINTS_X/2)*(X_BED_SIZE-2*MESH_INSET)/(GRID_MAX_POINTS_X-1)+MESH_INSET) // X point for Z homing when homing all axes (G28). #define Z_SAFE_HOMING_Y_POINT ((GRID_MAX_POINTS_Y/2)*(Y_BED_SIZE-2*MESH_INSET)/(GRID_MAX_POINTS_Y-1)+MESH_INSET) // Y point for Z homing when homing all axes (G28). #else From de5f33ec7ad21a290728cd7df09a4ab6729dd906 Mon Sep 17 00:00:00 2001 From: Kit Adams Date: Tue, 8 Jan 2019 10:51:13 +1300 Subject: [PATCH 5/7] Move UBL safe homing defaults (for homing at a grid point) from Configuration.h to Conditionals_post.h --- Marlin/Conditionals_post.h | 14 ++++++++++++-- Marlin/Configuration.h | 10 ++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 3707d77413db..3486bd59fcf7 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -191,10 +191,20 @@ */ #if ENABLED(Z_SAFE_HOMING) #ifndef Z_SAFE_HOMING_X_POINT - #define Z_SAFE_HOMING_X_POINT X_CENTER + #if ENABLED(AUTO_BED_LEVELING_UBL) + // Home at grid point close to bed center so this grid point will have z height very close to 0 + #define Z_SAFE_HOMING_X_POINT ((GRID_MAX_POINTS_X/2)*(X_BED_SIZE-2*MESH_INSET)/(GRID_MAX_POINTS_X-1)+MESH_INSET) + #else + #define Z_SAFE_HOMING_X_POINT X_CENTER + #endif #endif #ifndef Z_SAFE_HOMING_Y_POINT - #define Z_SAFE_HOMING_Y_POINT Y_CENTER + #if ENABLED(AUTO_BED_LEVELING_UBL) + // Home at grid point close to bed center so this grid point will have z height very close to 0 + #define Z_SAFE_HOMING_Y_POINT ((GRID_MAX_POINTS_Y/2)*(Y_BED_SIZE-2*MESH_INSET)/(GRID_MAX_POINTS_Y-1)+MESH_INSET) + #else + #define Z_SAFE_HOMING_Y_POINT Y_CENTER + #endif #endif #define X_TILT_FULCRUM Z_SAFE_HOMING_X_POINT #define Y_TILT_FULCRUM Z_SAFE_HOMING_Y_POINT diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index a2f0aa7b5c1a..2e95701c2de3 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1144,14 +1144,8 @@ //#define Z_SAFE_HOMING #if ENABLED(Z_SAFE_HOMING) - #if ENABLED(AUTO_BED_LEVELING_UBL) - // Try to home on a grid point to better allow checking mesh center - #define Z_SAFE_HOMING_X_POINT ((GRID_MAX_POINTS_X/2)*(X_BED_SIZE-2*MESH_INSET)/(GRID_MAX_POINTS_X-1)+MESH_INSET) // X point for Z homing when homing all axes (G28). - #define Z_SAFE_HOMING_Y_POINT ((GRID_MAX_POINTS_Y/2)*(Y_BED_SIZE-2*MESH_INSET)/(GRID_MAX_POINTS_Y-1)+MESH_INSET) // Y point for Z homing when homing all axes (G28). - #else - #define Z_SAFE_HOMING_X_POINT ((X_BED_SIZE) / 2) // X point for Z homing when homing all axes (G28). - #define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE) / 2) // Y point for Z homing when homing all axes (G28). - #endif + #define Z_SAFE_HOMING_X_POINT ((X_BED_SIZE) / 2) // X point for Z homing when homing all axes (G28). + #define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE) / 2) // Y point for Z homing when homing all axes (G28). #endif // Homing speeds (mm/m) From 7c4640ef3f3f33cf30d6557b3ae0342a39e8695d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 4 Feb 2019 08:37:00 -0600 Subject: [PATCH 6/7] Update ubl.cpp --- Marlin/ubl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/ubl.cpp b/Marlin/ubl.cpp index d67149368bff..f4dd433dc6d5 100644 --- a/Marlin/ubl.cpp +++ b/Marlin/ubl.cpp @@ -213,8 +213,8 @@ // Add XY_PROBE_OFFSET_FROM_EXTRUDER because probe_pt() subtracts these when // moving to the xy position to be measured. This ensures better agreement between // the current Z position after G28 and the mesh values. - const float current_xi = find_closest_x_index(current_position[X_AXIS]+X_PROBE_OFFSET_FROM_EXTRUDER), - current_yi = find_closest_y_index(current_position[Y_AXIS]+Y_PROBE_OFFSET_FROM_EXTRUDER); + const float current_xi = find_closest_x_index(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER), + current_yi = find_closest_y_index(current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER); if (!lcd) SERIAL_EOL(); for (int8_t j = GRID_MAX_POINTS_Y - 1; j >= 0; j--) { From e8bd736ec13f41b69f6beb65c9cd1e4bf31047c7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 4 Feb 2019 08:41:44 -0600 Subject: [PATCH 7/7] Update Conditionals_post.h --- Marlin/Conditionals_post.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 3486bd59fcf7..42f47333bdba 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -190,21 +190,17 @@ * Safe Homing Options */ #if ENABLED(Z_SAFE_HOMING) + #if ENABLED(AUTO_BED_LEVELING_UBL) + // Home close to center so grid points have z heights very close to 0 + #define _SAFE_POINT(A) (((GRID_MAX_POINTS_##A) / 2) * (A##_BED_SIZE - 2 * (MESH_INSET)) / (GRID_MAX_POINTS_##A - 1) + MESH_INSET) + #else + #define _SAFE_POINT(A) A##_CENTER + #endif #ifndef Z_SAFE_HOMING_X_POINT - #if ENABLED(AUTO_BED_LEVELING_UBL) - // Home at grid point close to bed center so this grid point will have z height very close to 0 - #define Z_SAFE_HOMING_X_POINT ((GRID_MAX_POINTS_X/2)*(X_BED_SIZE-2*MESH_INSET)/(GRID_MAX_POINTS_X-1)+MESH_INSET) - #else - #define Z_SAFE_HOMING_X_POINT X_CENTER - #endif + #define Z_SAFE_HOMING_X_POINT _SAFE_POINT(X) #endif #ifndef Z_SAFE_HOMING_Y_POINT - #if ENABLED(AUTO_BED_LEVELING_UBL) - // Home at grid point close to bed center so this grid point will have z height very close to 0 - #define Z_SAFE_HOMING_Y_POINT ((GRID_MAX_POINTS_Y/2)*(Y_BED_SIZE-2*MESH_INSET)/(GRID_MAX_POINTS_Y-1)+MESH_INSET) - #else - #define Z_SAFE_HOMING_Y_POINT Y_CENTER - #endif + #define Z_SAFE_HOMING_Y_POINT _SAFE_POINT(Y) #endif #define X_TILT_FULCRUM Z_SAFE_HOMING_X_POINT #define Y_TILT_FULCRUM Z_SAFE_HOMING_Y_POINT