Kaynağa Gözat

Fix NAN mesh entries with ABL_BILINEAR_SUBDIVISION (#20143)

Jason Smith 4 yıl önce
ebeveyn
işleme
50a77ef7f0
No account linked to committer's email address
1 değiştirilmiş dosya ile 8 ekleme ve 0 silme
  1. 8
    0
      Marlin/src/feature/bedlevel/abl/abl.cpp

+ 8
- 0
Marlin/src/feature/bedlevel/abl/abl.cpp Dosyayı Görüntüle

161
   #define LINEAR_EXTRAPOLATION(E, I) ((E) * 2 - (I))
161
   #define LINEAR_EXTRAPOLATION(E, I) ((E) * 2 - (I))
162
   float bed_level_virt_coord(const uint8_t x, const uint8_t y) {
162
   float bed_level_virt_coord(const uint8_t x, const uint8_t y) {
163
     uint8_t ep = 0, ip = 1;
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
     if (!x || x == ABL_TEMP_POINTS_X - 1) {
172
     if (!x || x == ABL_TEMP_POINTS_X - 1) {
165
       if (x) {
173
       if (x) {
166
         ep = GRID_MAX_POINTS_X - 1;
174
         ep = GRID_MAX_POINTS_X - 1;

Loading…
İptal
Kaydet