Compact smart_fill_mesh slightly

master
Scott Lahteine 8 years ago
parent 628391304f
commit ecdf68735f

@ -1533,21 +1533,6 @@
typedef struct { uint8_t sx, ex, sy, ey; bool yfirst; } smart_fill_info;
void smart_fill_loop(const smart_fill_info &f) {
if (f.yfirst) {
const int8_t dir = f.ex > f.sx ? 1 : -1;
for (uint8_t y = f.sy; y != f.ey; ++y)
for (uint8_t x = f.sx; x != f.ex; x += dir)
if (smart_fill_one(x, y, dir, 0)) break;
}
else {
const int8_t dir = f.ey > f.sy ? 1 : -1;
for (uint8_t x = f.sx; x != f.ex; ++x)
for (uint8_t y = f.sy; y != f.ey; y += dir)
if (smart_fill_one(x, y, 0, dir)) break;
}
}
void smart_fill_mesh() {
const smart_fill_info info[] = {
{ 0, GRID_MAX_POINTS_X, 0, GRID_MAX_POINTS_Y - 2, false }, // Bottom of the mesh looking up
@ -1555,7 +1540,21 @@
{ 0, GRID_MAX_POINTS_X - 2, 0, GRID_MAX_POINTS_Y, true }, // Left side of the mesh looking right
{ GRID_MAX_POINTS_X - 1, 0, 0, GRID_MAX_POINTS_Y, true } // Right side of the mesh looking left
};
for (uint8_t i = 0; i < COUNT(info); ++i) smart_fill_loop(info[i]);
for (uint8_t i = 0; i < COUNT(info); ++i) {
const smart_fill_info &f = info[i];
if (f.yfirst) {
const int8_t dir = f.ex > f.sx ? 1 : -1;
for (uint8_t y = f.sy; y != f.ey; ++y)
for (uint8_t x = f.sx; x != f.ex; x += dir)
if (smart_fill_one(x, y, dir, 0)) break;
}
else {
const int8_t dir = f.ey > f.sy ? 1 : -1;
for (uint8_t x = f.sx; x != f.ex; ++x)
for (uint8_t y = f.sy; y != f.ey; y += dir)
if (smart_fill_one(x, y, 0, dir)) break;
}
}
}
void unified_bed_leveling::tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map) {

Loading…
Cancel
Save