瀏覽代碼

Let M421 C select any point

Fixing #21147
Scott Lahteine 4 年之前
父節點
當前提交
4428affc20

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

32
 #define UBL_OK false
32
 #define UBL_OK false
33
 #define UBL_ERR true
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
 // External references
37
 // External references
38
 
38
 

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

1282
 
1282
 
1283
   static bool test_func(uint8_t i, uint8_t j, void *data) {
1283
   static bool test_func(uint8_t i, uint8_t j, void *data) {
1284
     find_closest_t *d = (find_closest_t*)data;
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
       || (d->type == SET_IN_BITMAP && !d->done_flags->marked(i, j))
1286
       || (d->type == SET_IN_BITMAP && !d->done_flags->marked(i, j))
1287
     ) {
1287
     ) {
1288
       // Found a Mesh Point of the specified type!
1288
       // Found a Mesh Point of the specified type!
1326
     float best_so_far = 99999.99f;
1326
     float best_so_far = 99999.99f;
1327
 
1327
 
1328
     GRID_LOOP(i, j) {
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
         || (type == SET_IN_BITMAP && !done_flags->marked(i, j))
1330
         || (type == SET_IN_BITMAP && !done_flags->marked(i, j))
1331
       ) {
1331
       ) {
1332
         // Found a Mesh Point of the specified type!
1332
         // Found a Mesh Point of the specified type!

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

54
              hasZ = parser.seen('Z'),
54
              hasZ = parser.seen('Z'),
55
              hasQ = !hasZ && parser.seen('Q');
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
   if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ || hasN))
59
   if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ || hasN))
60
     SERIAL_ERROR_MSG(STR_ERR_M421_PARAMETERS);
60
     SERIAL_ERROR_MSG(STR_ERR_M421_PARAMETERS);

Loading…
取消
儲存