|
@@ -2588,7 +2588,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2588
|
2588
|
/**
|
2589
|
2589
|
* Extrapolate a single point from its neighbors
|
2590
|
2590
|
*/
|
2591
|
|
- static void extrapolate_one_point(uint8_t x, uint8_t y, int8_t xdir, int8_t ydir) {
|
|
2591
|
+ static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir) {
|
2592
|
2592
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
2593
|
2593
|
if (DEBUGGING(LEVELING)) {
|
2594
|
2594
|
SERIAL_ECHOPGM("Extrapolate [");
|
|
@@ -2611,9 +2611,10 @@ static void clean_up_after_endstop_or_probe_move() {
|
2611
|
2611
|
SERIAL_EOL;
|
2612
|
2612
|
|
2613
|
2613
|
// Get X neighbors, Y neighbors, and XY neighbors
|
2614
|
|
- float a1 = z_values[x + xdir][y], a2 = z_values[x + xdir * 2][y],
|
2615
|
|
- b1 = z_values[x][y + ydir], b2 = z_values[x][y + ydir * 2],
|
2616
|
|
- c1 = z_values[x + xdir][y + ydir], c2 = z_values[x + xdir * 2][y + ydir * 2];
|
|
2614
|
+ const uint8_t x1 = x + xdir, y1 = y + ydir, x2 = x1 + xdir, y2 = y1 + ydir;
|
|
2615
|
+ float a1 = z_values[x1][y ], a2 = z_values[x2][y ],
|
|
2616
|
+ b1 = z_values[x ][y1], b2 = z_values[x ][y2],
|
|
2617
|
+ c1 = z_values[x1][y1], c2 = z_values[x2][y2];
|
2617
|
2618
|
|
2618
|
2619
|
// Treat far unprobed points as zero, near as equal to far
|
2619
|
2620
|
if (isnan(a2)) a2 = 0.0; if (isnan(a1)) a1 = a2;
|
|
@@ -2647,19 +2648,19 @@ static void clean_up_after_endstop_or_probe_move() {
|
2647
|
2648
|
*/
|
2648
|
2649
|
static void extrapolate_unprobed_bed_level() {
|
2649
|
2650
|
#ifdef HALF_IN_X
|
2650
|
|
- const uint8_t ctrx2 = 0, xlen = GRID_MAX_POINTS_X - 1;
|
|
2651
|
+ constexpr uint8_t ctrx2 = 0, xlen = GRID_MAX_POINTS_X - 1;
|
2651
|
2652
|
#else
|
2652
|
|
- const uint8_t ctrx1 = (GRID_MAX_POINTS_X - 1) / 2, // left-of-center
|
2653
|
|
- ctrx2 = GRID_MAX_POINTS_X / 2, // right-of-center
|
2654
|
|
- xlen = ctrx1;
|
|
2653
|
+ constexpr uint8_t ctrx1 = (GRID_MAX_POINTS_X - 1) / 2, // left-of-center
|
|
2654
|
+ ctrx2 = (GRID_MAX_POINTS_X) / 2, // right-of-center
|
|
2655
|
+ xlen = ctrx1;
|
2655
|
2656
|
#endif
|
2656
|
2657
|
|
2657
|
2658
|
#ifdef HALF_IN_Y
|
2658
|
|
- const uint8_t ctry2 = 0, ylen = GRID_MAX_POINTS_Y - 1;
|
|
2659
|
+ constexpr uint8_t ctry2 = 0, ylen = GRID_MAX_POINTS_Y - 1;
|
2659
|
2660
|
#else
|
2660
|
|
- const uint8_t ctry1 = (GRID_MAX_POINTS_Y - 1) / 2, // top-of-center
|
2661
|
|
- ctry2 = GRID_MAX_POINTS_Y / 2, // bottom-of-center
|
2662
|
|
- ylen = ctry1;
|
|
2661
|
+ constexpr uint8_t ctry1 = (GRID_MAX_POINTS_Y - 1) / 2, // top-of-center
|
|
2662
|
+ ctry2 = (GRID_MAX_POINTS_Y) / 2, // bottom-of-center
|
|
2663
|
+ ylen = ctry1;
|
2663
|
2664
|
#endif
|
2664
|
2665
|
|
2665
|
2666
|
for (uint8_t xo = 0; xo <= xlen; xo++)
|