Przeglądaj źródła

Modify UBL mesh_is_valid and use in leveling_is_valid (#10746)

Scott Lahteine 7 lat temu
rodzic
commit
eb2eb72720
No account linked to committer's email address

+ 1
- 1
Marlin/src/feature/bedlevel/bedlevel.cpp Wyświetl plik

53
     #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
53
     #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
54
       !!bilinear_grid_spacing[X_AXIS]
54
       !!bilinear_grid_spacing[X_AXIS]
55
     #elif ENABLED(AUTO_BED_LEVELING_UBL)
55
     #elif ENABLED(AUTO_BED_LEVELING_UBL)
56
-      true
56
+      ubl.mesh_is_valid()
57
     #else // 3POINT, LINEAR
57
     #else // 3POINT, LINEAR
58
       true
58
       true
59
     #endif
59
     #endif

+ 5
- 11
Marlin/src/feature/bedlevel/ubl/ubl.h Wyświetl plik

363
       static void line_to_destination_cartesian(const float &fr, const uint8_t e);
363
       static void line_to_destination_cartesian(const float &fr, const uint8_t e);
364
     #endif
364
     #endif
365
 
365
 
366
-    #define _CMPZ(a,b) (z_values[a][b] == z_values[a][b+1])
367
-    #define CMPZ(a) (_CMPZ(a, 0) && _CMPZ(a, 1))
368
-    #define ZZER(a) (z_values[a][0] == 0)
369
-
370
-    FORCE_INLINE bool mesh_is_valid() {
371
-      return !(
372
-        (    CMPZ(0) && CMPZ(1) && CMPZ(2) // adjacent z values all equal?
373
-          && ZZER(0) && ZZER(1) && ZZER(2) // all zero at the edge?
374
-        )
375
-        || isnan(z_values[0][0])
376
-      );
366
+    inline static bool mesh_is_valid() {
367
+      for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
368
+        for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
369
+          if (isnan(z_values[x][y])) return false;
370
+      return true;
377
     }
371
     }
378
 
372
 
379
 }; // class unified_bed_leveling
373
 }; // class unified_bed_leveling

+ 3
- 2
Marlin/src/gcode/bedlevel/M420.cpp Wyświetl plik

96
     // L or V display the map info
96
     // L or V display the map info
97
     if (parser.seen('L') || parser.seen('V')) {
97
     if (parser.seen('L') || parser.seen('V')) {
98
       ubl.display_map(parser.byteval('T'));
98
       ubl.display_map(parser.byteval('T'));
99
-      SERIAL_ECHOLNPAIR("ubl.mesh_is_valid = ", ubl.mesh_is_valid());
100
-      SERIAL_ECHOLNPAIR("ubl.storage_slot = ", ubl.storage_slot);
99
+      SERIAL_ECHOPGM("Mesh is ");
100
+      if (!ubl.mesh_is_valid()) SERIAL_ECHOPGM("in");
101
+      SERIAL_ECHOLNPAIR("valid\nStorage slot: ", ubl.storage_slot);
101
     }
102
     }
102
 
103
 
103
   #endif // AUTO_BED_LEVELING_UBL
104
   #endif // AUTO_BED_LEVELING_UBL

Ładowanie…
Anuluj
Zapisz