浏览代码

Let M421 C select any point

Fixing #21147
Scott Lahteine 4 年前
父节点
当前提交
4428affc20

+ 1
- 1
Marlin/src/feature/bedlevel/ubl/ubl.h 查看文件

@@ -32,7 +32,7 @@
32 32
 #define UBL_OK false
33 33
 #define UBL_ERR true
34 34
 
35
-enum MeshPointType : char { INVALID, REAL, SET_IN_BITMAP };
35
+enum MeshPointType : char { INVALID, REAL, SET_IN_BITMAP, CLOSEST };
36 36
 
37 37
 // External references
38 38
 

+ 2
- 2
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp 查看文件

@@ -1282,7 +1282,7 @@ mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {
1282 1282
 
1283 1283
   static bool test_func(uint8_t i, uint8_t j, void *data) {
1284 1284
     find_closest_t *d = (find_closest_t*)data;
1285
-    if ( (d->type == (isnan(ubl.z_values[i][j]) ? INVALID : REAL))
1285
+    if (  d->type == CLOSEST || d->type == (isnan(ubl.z_values[i][j]) ? INVALID : REAL)
1286 1286
       || (d->type == SET_IN_BITMAP && !d->done_flags->marked(i, j))
1287 1287
     ) {
1288 1288
       // Found a Mesh Point of the specified type!
@@ -1326,7 +1326,7 @@ mesh_index_pair unified_bed_leveling::find_closest_mesh_point_of_type(const Mesh
1326 1326
     float best_so_far = 99999.99f;
1327 1327
 
1328 1328
     GRID_LOOP(i, j) {
1329
-      if ( (type == (isnan(z_values[i][j]) ? INVALID : REAL))
1329
+      if (  type == CLOSEST || type == (isnan(z_values[i][j]) ? INVALID : REAL)
1330 1330
         || (type == SET_IN_BITMAP && !done_flags->marked(i, j))
1331 1331
       ) {
1332 1332
         // Found a Mesh Point of the specified type!

+ 1
- 1
Marlin/src/gcode/bedlevel/ubl/M421.cpp 查看文件

@@ -54,7 +54,7 @@ void GcodeSuite::M421() {
54 54
              hasZ = parser.seen('Z'),
55 55
              hasQ = !hasZ && parser.seen('Q');
56 56
 
57
-  if (hasC) ij = ubl.find_closest_mesh_point_of_type(REAL, current_position);
57
+  if (hasC) ij = ubl.find_closest_mesh_point_of_type(CLOSEST, current_position);
58 58
 
59 59
   if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ || hasN))
60 60
     SERIAL_ERROR_MSG(STR_ERR_M421_PARAMETERS);

正在加载...
取消
保存