|
@@ -495,7 +495,7 @@ static uint8_t target_extruder;
|
495
|
495
|
|
496
|
496
|
#if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
|
497
|
497
|
int nonlinear_grid_spacing[2] = { 0 };
|
498
|
|
- float bed_level[AUTO_BED_LEVELING_GRID_POINTS][AUTO_BED_LEVELING_GRID_POINTS];
|
|
498
|
+ float bed_level_grid[AUTO_BED_LEVELING_GRID_POINTS][AUTO_BED_LEVELING_GRID_POINTS];
|
499
|
499
|
#endif
|
500
|
500
|
|
501
|
501
|
#if IS_SCARA
|
|
@@ -2104,12 +2104,12 @@ static void clean_up_after_endstop_or_probe_move() {
|
2104
|
2104
|
* All DELTA leveling in the Marlin uses NONLINEAR_BED_LEVELING
|
2105
|
2105
|
*/
|
2106
|
2106
|
static void extrapolate_one_point(int x, int y, int xdir, int ydir) {
|
2107
|
|
- if (bed_level[x][y] != 0.0) {
|
|
2107
|
+ if (bed_level_grid[x][y] != 0.0) {
|
2108
|
2108
|
return; // Don't overwrite good values.
|
2109
|
2109
|
}
|
2110
|
|
- float a = 2 * bed_level[x + xdir][y] - bed_level[x + xdir * 2][y]; // Left to right.
|
2111
|
|
- float b = 2 * bed_level[x][y + ydir] - bed_level[x][y + ydir * 2]; // Front to back.
|
2112
|
|
- float c = 2 * bed_level[x + xdir][y + ydir] - bed_level[x + xdir * 2][y + ydir * 2]; // Diagonal.
|
|
2110
|
+ float a = 2 * bed_level_grid[x + xdir][y] - bed_level_grid[x + xdir * 2][y]; // Left to right.
|
|
2111
|
+ float b = 2 * bed_level_grid[x][y + ydir] - bed_level_grid[x][y + ydir * 2]; // Front to back.
|
|
2112
|
+ float c = 2 * bed_level_grid[x + xdir][y + ydir] - bed_level_grid[x + xdir * 2][y + ydir * 2]; // Diagonal.
|
2113
|
2113
|
float median = c; // Median is robust (ignores outliers).
|
2114
|
2114
|
if (a < b) {
|
2115
|
2115
|
if (b < c) median = b;
|
|
@@ -2119,7 +2119,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2119
|
2119
|
if (c < b) median = b;
|
2120
|
2120
|
if (a < c) median = a;
|
2121
|
2121
|
}
|
2122
|
|
- bed_level[x][y] = median;
|
|
2122
|
+ bed_level_grid[x][y] = median;
|
2123
|
2123
|
}
|
2124
|
2124
|
|
2125
|
2125
|
/**
|
|
@@ -2145,7 +2145,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2145
|
2145
|
static void print_bed_level() {
|
2146
|
2146
|
for (int y = 0; y < AUTO_BED_LEVELING_GRID_POINTS; y++) {
|
2147
|
2147
|
for (int x = 0; x < AUTO_BED_LEVELING_GRID_POINTS; x++) {
|
2148
|
|
- SERIAL_PROTOCOL_F(bed_level[x][y], 2);
|
|
2148
|
+ SERIAL_PROTOCOL_F(bed_level_grid[x][y], 2);
|
2149
|
2149
|
SERIAL_PROTOCOLCHAR(' ');
|
2150
|
2150
|
}
|
2151
|
2151
|
SERIAL_EOL;
|
|
@@ -2161,7 +2161,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2161
|
2161
|
#endif
|
2162
|
2162
|
for (int y = 0; y < AUTO_BED_LEVELING_GRID_POINTS; y++) {
|
2163
|
2163
|
for (int x = 0; x < AUTO_BED_LEVELING_GRID_POINTS; x++) {
|
2164
|
|
- bed_level[x][y] = 0.0;
|
|
2164
|
+ bed_level_grid[x][y] = 0.0;
|
2165
|
2165
|
}
|
2166
|
2166
|
}
|
2167
|
2167
|
}
|
|
@@ -3513,7 +3513,7 @@ inline void gcode_G28() {
|
3513
|
3513
|
|
3514
|
3514
|
#elif ENABLED(AUTO_BED_LEVELING_NONLINEAR)
|
3515
|
3515
|
|
3516
|
|
- bed_level[xCount][yCount] = measured_z + zoffset;
|
|
3516
|
+ bed_level_grid[xCount][yCount] = measured_z + zoffset;
|
3517
|
3517
|
|
3518
|
3518
|
#endif
|
3519
|
3519
|
|
|
@@ -7807,10 +7807,10 @@ void ok_to_send() {
|
7807
|
7807
|
grid_y = max(h1, min(h2, RAW_Y_POSITION(cartesian[Y_AXIS]) / nonlinear_grid_spacing[Y_AXIS]));
|
7808
|
7808
|
int floor_x = floor(grid_x), floor_y = floor(grid_y);
|
7809
|
7809
|
float ratio_x = grid_x - floor_x, ratio_y = grid_y - floor_y,
|
7810
|
|
- z1 = bed_level[floor_x + half][floor_y + half],
|
7811
|
|
- z2 = bed_level[floor_x + half][floor_y + half + 1],
|
7812
|
|
- z3 = bed_level[floor_x + half + 1][floor_y + half],
|
7813
|
|
- z4 = bed_level[floor_x + half + 1][floor_y + half + 1],
|
|
7810
|
+ z1 = bed_level_grid[floor_x + half][floor_y + half],
|
|
7811
|
+ z2 = bed_level_grid[floor_x + half][floor_y + half + 1],
|
|
7812
|
+ z3 = bed_level_grid[floor_x + half + 1][floor_y + half],
|
|
7813
|
+ z4 = bed_level_grid[floor_x + half + 1][floor_y + half + 1],
|
7814
|
7814
|
left = (1 - ratio_y) * z1 + ratio_y * z2,
|
7815
|
7815
|
right = (1 - ratio_y) * z3 + ratio_y * z4,
|
7816
|
7816
|
offset = (1 - ratio_x) * left + ratio_x * right;
|