Explorar el Código

UBL G29 T current position fix

Counterpart to #12845
Scott Lahteine hace 5 años
padre
commit
f37df28d17
Se han modificado 2 ficheros con 13 adiciones y 4 borrados
  1. 5
    2
      Marlin/src/feature/bedlevel/ubl/ubl.cpp
  2. 8
    2
      Marlin/src/inc/Conditionals_post.h

+ 5
- 2
Marlin/src/feature/bedlevel/ubl/ubl.cpp Ver fichero

@@ -198,8 +198,11 @@
198 198
       serialprintPGM(csv ? PSTR("CSV:\n") : PSTR("LCD:\n"));
199 199
     }
200 200
 
201
-    const float current_xi = get_cell_index_x(current_position[X_AXIS] + (MESH_X_DIST) / 2.0),
202
-                current_yi = get_cell_index_y(current_position[Y_AXIS] + (MESH_Y_DIST) / 2.0);
201
+    // Add XY_PROBE_OFFSET_FROM_EXTRUDER because probe_pt() subtracts these when
202
+    // moving to the xy position to be measured. This ensures better agreement between
203
+    // the current Z position after G28 and the mesh values.
204
+    const float current_xi = find_closest_x_index(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER),
205
+                current_yi = find_closest_y_index(current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER);
203 206
 
204 207
     if (!lcd) SERIAL_EOL();
205 208
     for (int8_t j = GRID_MAX_POINTS_Y - 1; j >= 0; j--) {

+ 8
- 2
Marlin/src/inc/Conditionals_post.h Ver fichero

@@ -203,11 +203,17 @@
203 203
  * Safe Homing Options
204 204
  */
205 205
 #if ENABLED(Z_SAFE_HOMING)
206
+  #if ENABLED(AUTO_BED_LEVELING_UBL)
207
+    // Home close to center so grid points have z heights very close to 0
208
+    #define _SAFE_POINT(A) (((GRID_MAX_POINTS_##A) / 2) * (A##_BED_SIZE - 2 * (MESH_INSET)) / (GRID_MAX_POINTS_##A - 1) + MESH_INSET)
209
+  #else
210
+    #define _SAFE_POINT(A) A##_CENTER
211
+  #endif
206 212
   #ifndef Z_SAFE_HOMING_X_POINT
207
-    #define Z_SAFE_HOMING_X_POINT X_CENTER
213
+    #define Z_SAFE_HOMING_X_POINT _SAFE_POINT(X)
208 214
   #endif
209 215
   #ifndef Z_SAFE_HOMING_Y_POINT
210
-    #define Z_SAFE_HOMING_Y_POINT Y_CENTER
216
+    #define Z_SAFE_HOMING_Y_POINT _SAFE_POINT(Y)
211 217
   #endif
212 218
   #define X_TILT_FULCRUM Z_SAFE_HOMING_X_POINT
213 219
   #define Y_TILT_FULCRUM Z_SAFE_HOMING_Y_POINT

Loading…
Cancelar
Guardar