|
@@ -576,7 +576,7 @@ static uint8_t target_extruder;
|
576
|
576
|
|
577
|
577
|
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
578
|
578
|
int bilinear_grid_spacing[2] = { 0 }, bilinear_start[2] = { 0 };
|
579
|
|
- float bed_level_grid[ABL_GRID_POINTS_X][ABL_GRID_POINTS_Y];
|
|
579
|
+ float bed_level_grid[ABL_GRID_MAX_POINTS_X][ABL_GRID_MAX_POINTS_Y];
|
580
|
580
|
#endif
|
581
|
581
|
|
582
|
582
|
#if IS_SCARA
|
|
@@ -2303,8 +2303,8 @@ static void clean_up_after_endstop_or_probe_move() {
|
2303
|
2303
|
#if ABL_PLANAR
|
2304
|
2304
|
planner.bed_level_matrix.set_to_identity();
|
2305
|
2305
|
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
2306
|
|
- for (uint8_t x = 0; x < ABL_GRID_POINTS_X; x++)
|
2307
|
|
- for (uint8_t y = 0; y < ABL_GRID_POINTS_Y; y++)
|
|
2306
|
+ for (uint8_t x = 0; x < ABL_GRID_MAX_POINTS_X; x++)
|
|
2307
|
+ for (uint8_t y = 0; y < ABL_GRID_MAX_POINTS_Y; y++)
|
2308
|
2308
|
bed_level_grid[x][y] = 1000.0;
|
2309
|
2309
|
#endif
|
2310
|
2310
|
#endif
|
|
@@ -2363,9 +2363,9 @@ static void clean_up_after_endstop_or_probe_move() {
|
2363
|
2363
|
//#define EXTRAPOLATE_FROM_EDGE
|
2364
|
2364
|
|
2365
|
2365
|
#if ENABLED(EXTRAPOLATE_FROM_EDGE)
|
2366
|
|
- #if ABL_GRID_POINTS_X < ABL_GRID_POINTS_Y
|
|
2366
|
+ #if ABL_GRID_MAX_POINTS_X < ABL_GRID_MAX_POINTS_Y
|
2367
|
2367
|
#define HALF_IN_X
|
2368
|
|
- #elif ABL_GRID_POINTS_Y < ABL_GRID_POINTS_X
|
|
2368
|
+ #elif ABL_GRID_MAX_POINTS_Y < ABL_GRID_MAX_POINTS_X
|
2369
|
2369
|
#define HALF_IN_Y
|
2370
|
2370
|
#endif
|
2371
|
2371
|
#endif
|
|
@@ -2376,18 +2376,18 @@ static void clean_up_after_endstop_or_probe_move() {
|
2376
|
2376
|
*/
|
2377
|
2377
|
static void extrapolate_unprobed_bed_level() {
|
2378
|
2378
|
#ifdef HALF_IN_X
|
2379
|
|
- const uint8_t ctrx2 = 0, xlen = ABL_GRID_POINTS_X - 1;
|
|
2379
|
+ const uint8_t ctrx2 = 0, xlen = ABL_GRID_MAX_POINTS_X - 1;
|
2380
|
2380
|
#else
|
2381
|
|
- const uint8_t ctrx1 = (ABL_GRID_POINTS_X - 1) / 2, // left-of-center
|
2382
|
|
- ctrx2 = ABL_GRID_POINTS_X / 2, // right-of-center
|
|
2381
|
+ const uint8_t ctrx1 = (ABL_GRID_MAX_POINTS_X - 1) / 2, // left-of-center
|
|
2382
|
+ ctrx2 = ABL_GRID_MAX_POINTS_X / 2, // right-of-center
|
2383
|
2383
|
xlen = ctrx1;
|
2384
|
2384
|
#endif
|
2385
|
2385
|
|
2386
|
2386
|
#ifdef HALF_IN_Y
|
2387
|
|
- const uint8_t ctry2 = 0, ylen = ABL_GRID_POINTS_Y - 1;
|
|
2387
|
+ const uint8_t ctry2 = 0, ylen = ABL_GRID_MAX_POINTS_Y - 1;
|
2388
|
2388
|
#else
|
2389
|
|
- const uint8_t ctry1 = (ABL_GRID_POINTS_Y - 1) / 2, // top-of-center
|
2390
|
|
- ctry2 = ABL_GRID_POINTS_Y / 2, // bottom-of-center
|
|
2389
|
+ const uint8_t ctry1 = (ABL_GRID_MAX_POINTS_Y - 1) / 2, // top-of-center
|
|
2390
|
+ ctry2 = ABL_GRID_MAX_POINTS_Y / 2, // bottom-of-center
|
2391
|
2391
|
ylen = ctry1;
|
2392
|
2392
|
#endif
|
2393
|
2393
|
|
|
@@ -2417,16 +2417,16 @@ static void clean_up_after_endstop_or_probe_move() {
|
2417
|
2417
|
*/
|
2418
|
2418
|
static void print_bed_level() {
|
2419
|
2419
|
SERIAL_ECHOPGM("Bilinear Leveling Grid:\n ");
|
2420
|
|
- for (uint8_t x = 0; x < ABL_GRID_POINTS_X; x++) {
|
|
2420
|
+ for (uint8_t x = 0; x < ABL_GRID_MAX_POINTS_X; x++) {
|
2421
|
2421
|
SERIAL_PROTOCOLPGM(" ");
|
2422
|
2422
|
if (x < 10) SERIAL_PROTOCOLCHAR(' ');
|
2423
|
2423
|
SERIAL_PROTOCOL((int)x);
|
2424
|
2424
|
}
|
2425
|
2425
|
SERIAL_EOL;
|
2426
|
|
- for (uint8_t y = 0; y < ABL_GRID_POINTS_Y; y++) {
|
|
2426
|
+ for (uint8_t y = 0; y < ABL_GRID_MAX_POINTS_Y; y++) {
|
2427
|
2427
|
if (y < 10) SERIAL_PROTOCOLCHAR(' ');
|
2428
|
2428
|
SERIAL_PROTOCOL((int)y);
|
2429
|
|
- for (uint8_t x = 0; x < ABL_GRID_POINTS_X; x++) {
|
|
2429
|
+ for (uint8_t x = 0; x < ABL_GRID_MAX_POINTS_X; x++) {
|
2430
|
2430
|
SERIAL_PROTOCOLCHAR(' ');
|
2431
|
2431
|
float offset = bed_level_grid[x][y];
|
2432
|
2432
|
if (offset < 999.0) {
|
|
@@ -2442,10 +2442,10 @@ static void clean_up_after_endstop_or_probe_move() {
|
2442
|
2442
|
}
|
2443
|
2443
|
|
2444
|
2444
|
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
2445
|
|
- #define ABL_GRID_POINTS_VIRT_X (ABL_GRID_POINTS_X - 1) * (BILINEAR_SUBDIVISIONS) + 1
|
2446
|
|
- #define ABL_GRID_POINTS_VIRT_Y (ABL_GRID_POINTS_Y - 1) * (BILINEAR_SUBDIVISIONS) + 1
|
|
2445
|
+ #define ABL_GRID_POINTS_VIRT_X (ABL_GRID_MAX_POINTS_X - 1) * (BILINEAR_SUBDIVISIONS) + 1
|
|
2446
|
+ #define ABL_GRID_POINTS_VIRT_Y (ABL_GRID_MAX_POINTS_Y - 1) * (BILINEAR_SUBDIVISIONS) + 1
|
2447
|
2447
|
float bed_level_grid_virt[ABL_GRID_POINTS_VIRT_X][ABL_GRID_POINTS_VIRT_Y];
|
2448
|
|
- float bed_level_grid_virt_temp[ABL_GRID_POINTS_X + 2][ABL_GRID_POINTS_Y + 2]; //temporary for calculation (maybe dynamical?)
|
|
2448
|
+ float bed_level_grid_virt_temp[ABL_GRID_MAX_POINTS_X + 2][ABL_GRID_MAX_POINTS_Y + 2]; //temporary for calculation (maybe dynamical?)
|
2449
|
2449
|
int bilinear_grid_spacing_virt[2] = { 0 };
|
2450
|
2450
|
|
2451
|
2451
|
static void bed_level_virt_print() {
|
|
@@ -2475,9 +2475,9 @@ static void clean_up_after_endstop_or_probe_move() {
|
2475
|
2475
|
}
|
2476
|
2476
|
#define LINEAR_EXTRAPOLATION(E, I) (E * 2 - I)
|
2477
|
2477
|
static void bed_level_virt_prepare() {
|
2478
|
|
- for (uint8_t y = 1; y <= ABL_GRID_POINTS_Y; y++) {
|
|
2478
|
+ for (uint8_t y = 1; y <= ABL_GRID_MAX_POINTS_Y; y++) {
|
2479
|
2479
|
|
2480
|
|
- for (uint8_t x = 1; x <= ABL_GRID_POINTS_X; x++)
|
|
2480
|
+ for (uint8_t x = 1; x <= ABL_GRID_MAX_POINTS_X; x++)
|
2481
|
2481
|
bed_level_grid_virt_temp[x][y] = bed_level_grid[x - 1][y - 1];
|
2482
|
2482
|
|
2483
|
2483
|
bed_level_grid_virt_temp[0][y] = LINEAR_EXTRAPOLATION(
|
|
@@ -2485,21 +2485,21 @@ static void clean_up_after_endstop_or_probe_move() {
|
2485
|
2485
|
bed_level_grid_virt_temp[2][y]
|
2486
|
2486
|
);
|
2487
|
2487
|
|
2488
|
|
- bed_level_grid_virt_temp[(ABL_GRID_POINTS_X + 2) - 1][y] =
|
|
2488
|
+ bed_level_grid_virt_temp[(ABL_GRID_MAX_POINTS_X + 2) - 1][y] =
|
2489
|
2489
|
LINEAR_EXTRAPOLATION(
|
2490
|
|
- bed_level_grid_virt_temp[(ABL_GRID_POINTS_X + 2) - 2][y],
|
2491
|
|
- bed_level_grid_virt_temp[(ABL_GRID_POINTS_X + 2) - 3][y]
|
|
2490
|
+ bed_level_grid_virt_temp[(ABL_GRID_MAX_POINTS_X + 2) - 2][y],
|
|
2491
|
+ bed_level_grid_virt_temp[(ABL_GRID_MAX_POINTS_X + 2) - 3][y]
|
2492
|
2492
|
);
|
2493
|
2493
|
}
|
2494
|
|
- for (uint8_t x = 0; x < ABL_GRID_POINTS_X + 2; x++) {
|
|
2494
|
+ for (uint8_t x = 0; x < ABL_GRID_MAX_POINTS_X + 2; x++) {
|
2495
|
2495
|
bed_level_grid_virt_temp[x][0] = LINEAR_EXTRAPOLATION(
|
2496
|
2496
|
bed_level_grid_virt_temp[x][1],
|
2497
|
2497
|
bed_level_grid_virt_temp[x][2]
|
2498
|
2498
|
);
|
2499
|
|
- bed_level_grid_virt_temp[x][(ABL_GRID_POINTS_Y + 2) - 1] =
|
|
2499
|
+ bed_level_grid_virt_temp[x][(ABL_GRID_MAX_POINTS_Y + 2) - 1] =
|
2500
|
2500
|
LINEAR_EXTRAPOLATION(
|
2501
|
|
- bed_level_grid_virt_temp[x][(ABL_GRID_POINTS_Y + 2) - 2],
|
2502
|
|
- bed_level_grid_virt_temp[x][(ABL_GRID_POINTS_Y + 2) - 3]
|
|
2501
|
+ bed_level_grid_virt_temp[x][(ABL_GRID_MAX_POINTS_Y + 2) - 2],
|
|
2502
|
+ bed_level_grid_virt_temp[x][(ABL_GRID_MAX_POINTS_Y + 2) - 3]
|
2503
|
2503
|
);
|
2504
|
2504
|
}
|
2505
|
2505
|
}
|
|
@@ -2521,11 +2521,11 @@ static void clean_up_after_endstop_or_probe_move() {
|
2521
|
2521
|
return bed_level_virt_cmr(row, 1, tx);
|
2522
|
2522
|
}
|
2523
|
2523
|
static void bed_level_virt_interpolate() {
|
2524
|
|
- for (uint8_t y = 0; y < ABL_GRID_POINTS_Y; y++)
|
2525
|
|
- for (uint8_t x = 0; x < ABL_GRID_POINTS_X; x++)
|
|
2524
|
+ for (uint8_t y = 0; y < ABL_GRID_MAX_POINTS_Y; y++)
|
|
2525
|
+ for (uint8_t x = 0; x < ABL_GRID_MAX_POINTS_X; x++)
|
2526
|
2526
|
for (uint8_t ty = 0; ty < BILINEAR_SUBDIVISIONS; ty++)
|
2527
|
2527
|
for (uint8_t tx = 0; tx < BILINEAR_SUBDIVISIONS; tx++) {
|
2528
|
|
- if ((ty && y == ABL_GRID_POINTS_Y - 1) || (tx && x == ABL_GRID_POINTS_X - 1))
|
|
2528
|
+ if ((ty && y == ABL_GRID_MAX_POINTS_Y - 1) || (tx && x == ABL_GRID_MAX_POINTS_X - 1))
|
2529
|
2529
|
continue;
|
2530
|
2530
|
bed_level_grid_virt[x * (BILINEAR_SUBDIVISIONS) + tx][y * (BILINEAR_SUBDIVISIONS) + ty] =
|
2531
|
2531
|
bed_level_virt_2cmr(
|
|
@@ -3934,8 +3934,8 @@ inline void gcode_G28() {
|
3934
|
3934
|
|
3935
|
3935
|
// X and Y specify points in each direction, overriding the default
|
3936
|
3936
|
// These values may be saved with the completed mesh
|
3937
|
|
- int abl_grid_points_x = code_seen('X') ? code_value_int() : ABL_GRID_POINTS_X,
|
3938
|
|
- abl_grid_points_y = code_seen('Y') ? code_value_int() : ABL_GRID_POINTS_Y;
|
|
3937
|
+ int abl_grid_points_x = code_seen('X') ? code_value_int() : ABL_GRID_MAX_POINTS_X,
|
|
3938
|
+ abl_grid_points_y = code_seen('Y') ? code_value_int() : ABL_GRID_MAX_POINTS_Y;
|
3939
|
3939
|
|
3940
|
3940
|
if (code_seen('P')) abl_grid_points_x = abl_grid_points_y = code_value_int();
|
3941
|
3941
|
|
|
@@ -3946,7 +3946,7 @@ inline void gcode_G28() {
|
3946
|
3946
|
|
3947
|
3947
|
#else
|
3948
|
3948
|
|
3949
|
|
- const int abl_grid_points_x = ABL_GRID_POINTS_X, abl_grid_points_y = ABL_GRID_POINTS_Y;
|
|
3949
|
+ const int abl_grid_points_x = ABL_GRID_MAX_POINTS_X, abl_grid_points_y = ABL_GRID_MAX_POINTS_Y;
|
3950
|
3950
|
|
3951
|
3951
|
#endif
|
3952
|
3952
|
|
|
@@ -8757,8 +8757,8 @@ void ok_to_send() {
|
8757
|
8757
|
#define ABL_BG_GRID(X,Y) bed_level_grid_virt[X][Y]
|
8758
|
8758
|
#else
|
8759
|
8759
|
#define ABL_BG_SPACING(A) bilinear_grid_spacing[A]
|
8760
|
|
- #define ABL_BG_POINTS_X ABL_GRID_POINTS_X
|
8761
|
|
- #define ABL_BG_POINTS_Y ABL_GRID_POINTS_Y
|
|
8760
|
+ #define ABL_BG_POINTS_X ABL_GRID_MAX_POINTS_X
|
|
8761
|
+ #define ABL_BG_POINTS_Y ABL_GRID_MAX_POINTS_Y
|
8762
|
8762
|
#define ABL_BG_GRID(X,Y) bed_level_grid[X][Y]
|
8763
|
8763
|
#endif
|
8764
|
8764
|
|