Sfoglia il codice sorgente

Fix NAN mesh entries with ABL_BILINEAR_SUBDIVISION (#20143)

Jason Smith 4 anni fa
parent
commit
50a77ef7f0
Nessun account collegato all'indirizzo email del committer
1 ha cambiato i file con 8 aggiunte e 0 eliminazioni
  1. 8
    0
      Marlin/src/feature/bedlevel/abl/abl.cpp

+ 8
- 0
Marlin/src/feature/bedlevel/abl/abl.cpp Vedi File

@@ -161,6 +161,14 @@ void print_bilinear_leveling_grid() {
161 161
   #define LINEAR_EXTRAPOLATION(E, I) ((E) * 2 - (I))
162 162
   float bed_level_virt_coord(const uint8_t x, const uint8_t y) {
163 163
     uint8_t ep = 0, ip = 1;
164
+    if (x > GRID_MAX_POINTS_X + 1 || y > GRID_MAX_POINTS_Y + 1) {
165
+      // The requested point requires extrapolating two points beyond the mesh.
166
+      // These values are only requested for the edges of the mesh, which are always an actual mesh point,
167
+      // and do not require interpolation. When interpolation is not needed, this "Mesh + 2" point is
168
+      // cancelled out in bed_level_virt_cmr and does not impact the result. Return 0.0 rather than
169
+      // making this function more complex by extrapolating two points.
170
+      return 0.0;
171
+    }    
164 172
     if (!x || x == ABL_TEMP_POINTS_X - 1) {
165 173
       if (x) {
166 174
         ep = GRID_MAX_POINTS_X - 1;

Loading…
Annulla
Salva