Browse Source

Compact smart_fill_mesh slightly

Scott Lahteine 8 years ago
parent
commit
ecdf68735f
1 changed files with 15 additions and 16 deletions
  1. 15
    16
      Marlin/ubl_G29.cpp

+ 15
- 16
Marlin/ubl_G29.cpp View File

@@ -1533,21 +1533,6 @@
1533 1533
 
1534 1534
   typedef struct { uint8_t sx, ex, sy, ey; bool yfirst; } smart_fill_info;
1535 1535
 
1536
-  void smart_fill_loop(const smart_fill_info &f) {
1537
-    if (f.yfirst) {
1538
-      const int8_t dir = f.ex > f.sx ? 1 : -1;
1539
-      for (uint8_t y = f.sy; y != f.ey; ++y)
1540
-        for (uint8_t x = f.sx; x != f.ex; x += dir)
1541
-          if (smart_fill_one(x, y, dir, 0)) break;
1542
-    }
1543
-    else {
1544
-      const int8_t dir = f.ey > f.sy ? 1 : -1;
1545
-       for (uint8_t x = f.sx; x != f.ex; ++x)
1546
-        for (uint8_t y = f.sy; y != f.ey; y += dir)
1547
-          if (smart_fill_one(x, y, 0, dir)) break;
1548
-    }
1549
-  }
1550
-
1551 1536
   void smart_fill_mesh() {
1552 1537
     const smart_fill_info info[] = {
1553 1538
       { 0, GRID_MAX_POINTS_X,      0, GRID_MAX_POINTS_Y - 2,  false },  // Bottom of the mesh looking up
@@ -1555,7 +1540,21 @@
1555 1540
       { 0, GRID_MAX_POINTS_X - 2,  0, GRID_MAX_POINTS_Y,      true  },  // Left side of the mesh looking right
1556 1541
       { GRID_MAX_POINTS_X - 1, 0,  0, GRID_MAX_POINTS_Y,      true  }   // Right side of the mesh looking left
1557 1542
     };
1558
-    for (uint8_t i = 0; i < COUNT(info); ++i) smart_fill_loop(info[i]);
1543
+    for (uint8_t i = 0; i < COUNT(info); ++i) {
1544
+      const smart_fill_info &f = info[i];
1545
+      if (f.yfirst) {
1546
+        const int8_t dir = f.ex > f.sx ? 1 : -1;
1547
+        for (uint8_t y = f.sy; y != f.ey; ++y)
1548
+          for (uint8_t x = f.sx; x != f.ex; x += dir)
1549
+            if (smart_fill_one(x, y, dir, 0)) break;
1550
+      }
1551
+      else {
1552
+        const int8_t dir = f.ey > f.sy ? 1 : -1;
1553
+         for (uint8_t x = f.sx; x != f.ex; ++x)
1554
+          for (uint8_t y = f.sy; y != f.ey; y += dir)
1555
+            if (smart_fill_one(x, y, 0, dir)) break;
1556
+      }
1557
+    }
1559 1558
   }
1560 1559
 
1561 1560
   void unified_bed_leveling::tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map) {

Loading…
Cancel
Save