Ver código fonte

bed_level_grid => z_values (also *_virt array)

Scott Lahteine 8 anos atrás
pai
commit
091179d960
3 arquivos alterados com 30 adições e 30 exclusões
  1. 1
    1
      Marlin/Marlin.h
  2. 24
    24
      Marlin/Marlin_main.cpp
  3. 5
    5
      Marlin/configuration_store.cpp

+ 1
- 1
Marlin/Marlin.h Ver arquivo

@@ -313,7 +313,7 @@ float code_value_temp_diff();
313 313
 
314 314
 #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
315 315
   extern int bilinear_grid_spacing[2], bilinear_start[2];
316
-  extern float bed_level_grid[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
316
+  extern float z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
317 317
   float bilinear_z_offset(float logical[XYZ]);
318 318
   void set_bed_leveling_enabled(bool enable=true);
319 319
 #endif

+ 24
- 24
Marlin/Marlin_main.cpp Ver arquivo

@@ -599,7 +599,7 @@ static uint8_t target_extruder;
599 599
 
600 600
 #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
601 601
   int bilinear_grid_spacing[2], bilinear_start[2];
602
-  float bed_level_grid[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
602
+  float z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
603 603
 #endif
604 604
 
605 605
 #if IS_SCARA
@@ -2435,7 +2435,7 @@ static void clean_up_after_endstop_or_probe_move() {
2435 2435
         bilinear_grid_spacing[X_AXIS] = bilinear_grid_spacing[Y_AXIS] = 0;
2436 2436
         for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
2437 2437
           for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
2438
-            bed_level_grid[x][y] = NAN;
2438
+            z_values[x][y] = NAN;
2439 2439
       #elif ENABLED(AUTO_BED_LEVELING_UBL)
2440 2440
         ubl.reset();
2441 2441
       #endif
@@ -2533,7 +2533,7 @@ static void clean_up_after_endstop_or_probe_move() {
2533 2533
         SERIAL_CHAR(']');
2534 2534
       }
2535 2535
     #endif
2536
-    if (!isnan(bed_level_grid[x][y])) {
2536
+    if (!isnan(z_values[x][y])) {
2537 2537
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2538 2538
         if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM(" (done)");
2539 2539
       #endif
@@ -2542,9 +2542,9 @@ static void clean_up_after_endstop_or_probe_move() {
2542 2542
     SERIAL_EOL;
2543 2543
 
2544 2544
     // Get X neighbors, Y neighbors, and XY neighbors
2545
-    float a1 = bed_level_grid[x + xdir][y], a2 = bed_level_grid[x + xdir * 2][y],
2546
-          b1 = bed_level_grid[x][y + ydir], b2 = bed_level_grid[x][y + ydir * 2],
2547
-          c1 = bed_level_grid[x + xdir][y + ydir], c2 = bed_level_grid[x + xdir * 2][y + ydir * 2];
2545
+    float a1 = z_values[x + xdir][y], a2 = z_values[x + xdir * 2][y],
2546
+          b1 = z_values[x][y + ydir], b2 = z_values[x][y + ydir * 2],
2547
+          c1 = z_values[x + xdir][y + ydir], c2 = z_values[x + xdir * 2][y + ydir * 2];
2548 2548
 
2549 2549
     // Treat far unprobed points as zero, near as equal to far
2550 2550
     if (isnan(a2)) a2 = 0.0; if (isnan(a1)) a1 = a2;
@@ -2554,10 +2554,10 @@ static void clean_up_after_endstop_or_probe_move() {
2554 2554
     const float a = 2 * a1 - a2, b = 2 * b1 - b2, c = 2 * c1 - c2;
2555 2555
 
2556 2556
     // Take the average instead of the median
2557
-    bed_level_grid[x][y] = (a + b + c) / 3.0;
2557
+    z_values[x][y] = (a + b + c) / 3.0;
2558 2558
 
2559 2559
     // Median is robust (ignores outliers).
2560
-    // bed_level_grid[x][y] = (a < b) ? ((b < c) ? b : (c < a) ? a : c)
2560
+    // z_values[x][y] = (a < b) ? ((b < c) ? b : (c < a) ? a : c)
2561 2561
     //                                : ((c < b) ? b : (a < c) ? a : c);
2562 2562
   }
2563 2563
 
@@ -2617,7 +2617,7 @@ static void clean_up_after_endstop_or_probe_move() {
2617 2617
   static void print_bilinear_leveling_grid() {
2618 2618
     SERIAL_ECHOLNPGM("Bilinear Leveling Grid:");
2619 2619
     print_2d_array(GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y, 3,
2620
-      [](const uint8_t ix, const uint8_t iy) { return bed_level_grid[ix][iy]; }
2620
+      [](const uint8_t ix, const uint8_t iy) { return z_values[ix][iy]; }
2621 2621
     );
2622 2622
   }
2623 2623
 
@@ -2627,13 +2627,13 @@ static void clean_up_after_endstop_or_probe_move() {
2627 2627
     #define ABL_GRID_POINTS_VIRT_Y (GRID_MAX_POINTS_Y - 1) * (BILINEAR_SUBDIVISIONS) + 1
2628 2628
     #define ABL_TEMP_POINTS_X (GRID_MAX_POINTS_X + 2)
2629 2629
     #define ABL_TEMP_POINTS_Y (GRID_MAX_POINTS_Y + 2)
2630
-    float bed_level_grid_virt[ABL_GRID_POINTS_VIRT_X][ABL_GRID_POINTS_VIRT_Y];
2630
+    float z_values_virt[ABL_GRID_POINTS_VIRT_X][ABL_GRID_POINTS_VIRT_Y];
2631 2631
     int bilinear_grid_spacing_virt[2] = { 0 };
2632 2632
 
2633 2633
     static void bed_level_virt_print() {
2634 2634
       SERIAL_ECHOLNPGM("Subdivided with CATMULL ROM Leveling Grid:");
2635 2635
       print_2d_array(ABL_GRID_POINTS_VIRT_X, ABL_GRID_POINTS_VIRT_Y, 5,
2636
-        [](const uint8_t ix, const uint8_t iy) { return bed_level_grid_virt[ix][iy]; }
2636
+        [](const uint8_t ix, const uint8_t iy) { return z_values_virt[ix][iy]; }
2637 2637
       );
2638 2638
     }
2639 2639
 
@@ -2647,8 +2647,8 @@ static void clean_up_after_endstop_or_probe_move() {
2647 2647
         }
2648 2648
         if (WITHIN(y, 1, ABL_TEMP_POINTS_Y - 2))
2649 2649
           return LINEAR_EXTRAPOLATION(
2650
-            bed_level_grid[ep][y - 1],
2651
-            bed_level_grid[ip][y - 1]
2650
+            z_values[ep][y - 1],
2651
+            z_values[ip][y - 1]
2652 2652
           );
2653 2653
         else
2654 2654
           return LINEAR_EXTRAPOLATION(
@@ -2663,8 +2663,8 @@ static void clean_up_after_endstop_or_probe_move() {
2663 2663
         }
2664 2664
         if (WITHIN(x, 1, ABL_TEMP_POINTS_X - 2))
2665 2665
           return LINEAR_EXTRAPOLATION(
2666
-            bed_level_grid[x - 1][ep],
2667
-            bed_level_grid[x - 1][ip]
2666
+            z_values[x - 1][ep],
2667
+            z_values[x - 1][ip]
2668 2668
           );
2669 2669
         else
2670 2670
           return LINEAR_EXTRAPOLATION(
@@ -2672,7 +2672,7 @@ static void clean_up_after_endstop_or_probe_move() {
2672 2672
             bed_level_virt_coord(x, ip + 1)
2673 2673
           );
2674 2674
       }
2675
-      return bed_level_grid[x - 1][y - 1];
2675
+      return z_values[x - 1][y - 1];
2676 2676
     }
2677 2677
 
2678 2678
     static float bed_level_virt_cmr(const float p[4], const uint8_t i, const float t) {
@@ -2704,7 +2704,7 @@ static void clean_up_after_endstop_or_probe_move() {
2704 2704
             for (uint8_t tx = 0; tx < BILINEAR_SUBDIVISIONS; tx++) {
2705 2705
               if ((ty && y == GRID_MAX_POINTS_Y - 1) || (tx && x == GRID_MAX_POINTS_X - 1))
2706 2706
                 continue;
2707
-              bed_level_grid_virt[x * (BILINEAR_SUBDIVISIONS) + tx][y * (BILINEAR_SUBDIVISIONS) + ty] =
2707
+              z_values_virt[x * (BILINEAR_SUBDIVISIONS) + tx][y * (BILINEAR_SUBDIVISIONS) + ty] =
2708 2708
                 bed_level_virt_2cmr(
2709 2709
                   x + 1,
2710 2710
                   y + 1,
@@ -4281,7 +4281,7 @@ inline void gcode_G28() {
4281 4281
           }
4282 4282
           if (WITHIN(i, 0, GRID_MAX_POINTS_X - 1) && WITHIN(j, 0, GRID_MAX_POINTS_Y)) {
4283 4283
             set_bed_leveling_enabled(false);
4284
-            bed_level_grid[i][j] = z;
4284
+            z_values[i][j] = z;
4285 4285
             #if ENABLED(ABL_BILINEAR_SUBDIVISION)
4286 4286
               bed_level_virt_interpolate();
4287 4287
             #endif
@@ -4499,7 +4499,7 @@ inline void gcode_G28() {
4499 4499
 
4500 4500
         #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
4501 4501
 
4502
-          bed_level_grid[xCount][yCount] = measured_z + zoffset;
4502
+          z_values[xCount][yCount] = measured_z + zoffset;
4503 4503
 
4504 4504
         #elif ENABLED(AUTO_BED_LEVELING_3POINT)
4505 4505
 
@@ -4669,7 +4669,7 @@ inline void gcode_G28() {
4669 4669
 
4670 4670
             #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
4671 4671
 
4672
-              bed_level_grid[xCount][yCount] = measured_z + zoffset;
4672
+              z_values[xCount][yCount] = measured_z + zoffset;
4673 4673
 
4674 4674
             #endif
4675 4675
 
@@ -8390,7 +8390,7 @@ void quickstop_stepper() {
8390 8390
         #if ENABLED(AUTO_BED_LEVELING_UBL)
8391 8391
           ubl.z_values[px][py] = z;
8392 8392
         #else
8393
-          bed_level_grid[px][py] = z;
8393
+          z_values[px][py] = z;
8394 8394
           #if ENABLED(ABL_BILINEAR_SUBDIVISION)
8395 8395
             bed_level_virt_interpolate();
8396 8396
           #endif
@@ -8508,7 +8508,7 @@ inline void gcode_M503() {
8508 8508
         if (diff) {
8509 8509
           for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
8510 8510
             for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
8511
-              bed_level_grid[x][y] -= diff;
8511
+              z_values[x][y] -= diff;
8512 8512
         }
8513 8513
         #if ENABLED(ABL_BILINEAR_SUBDIVISION)
8514 8514
           bed_level_virt_interpolate();
@@ -10486,12 +10486,12 @@ void ok_to_send() {
10486 10486
     #define ABL_BG_SPACING(A) bilinear_grid_spacing_virt[A]
10487 10487
     #define ABL_BG_POINTS_X   ABL_GRID_POINTS_VIRT_X
10488 10488
     #define ABL_BG_POINTS_Y   ABL_GRID_POINTS_VIRT_Y
10489
-    #define ABL_BG_GRID(X,Y)  bed_level_grid_virt[X][Y]
10489
+    #define ABL_BG_GRID(X,Y)  z_values_virt[X][Y]
10490 10490
   #else
10491 10491
     #define ABL_BG_SPACING(A) bilinear_grid_spacing[A]
10492 10492
     #define ABL_BG_POINTS_X   GRID_MAX_POINTS_X
10493 10493
     #define ABL_BG_POINTS_Y   GRID_MAX_POINTS_Y
10494
-    #define ABL_BG_GRID(X,Y)  bed_level_grid[X][Y]
10494
+    #define ABL_BG_GRID(X,Y)  z_values[X][Y]
10495 10495
   #endif
10496 10496
 
10497 10497
   // Get the Z adjustment for non-linear bed leveling

+ 5
- 5
Marlin/configuration_store.cpp Ver arquivo

@@ -85,7 +85,7 @@
85 85
  *  307            GRID_MAX_POINTS_Y                (uint8_t)
86 86
  *  308            bilinear_grid_spacing            (int x2)
87 87
  *  312  G29 L F   bilinear_start                   (int x2)
88
- *  316            bed_level_grid[][]               (float x9, up to float x256) +988
88
+ *  316            z_values[][]                     (float x9, up to float x256) +988
89 89
  *
90 90
  * DELTA:                                           48 bytes
91 91
  *  348  M666 XYZ  endstop_adj                      (float x3)
@@ -382,9 +382,9 @@ void MarlinSettings::postprocess() {
382 382
     //
383 383
 
384 384
     #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
385
-      // Compile time test that sizeof(bed_level_grid) is as expected
385
+      // Compile time test that sizeof(z_values) is as expected
386 386
       static_assert(
387
-        sizeof(bed_level_grid) == (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) * sizeof(bed_level_grid[0][0]),
387
+        sizeof(z_values) == (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) * sizeof(z_values[0][0]),
388 388
         "Bilinear Z array is the wrong size."
389 389
       );
390 390
       const uint8_t grid_max_x = GRID_MAX_POINTS_X, grid_max_y = GRID_MAX_POINTS_Y;
@@ -392,7 +392,7 @@ void MarlinSettings::postprocess() {
392 392
       EEPROM_WRITE(grid_max_y);            // 1 byte
393 393
       EEPROM_WRITE(bilinear_grid_spacing); // 2 ints
394 394
       EEPROM_WRITE(bilinear_start);        // 2 ints
395
-      EEPROM_WRITE(bed_level_grid);        // 9-256 floats
395
+      EEPROM_WRITE(z_values);              // 9-256 floats
396 396
     #else
397 397
       // For disabled Bilinear Grid write an empty 3x3 grid
398 398
       const uint8_t grid_max_x = 3, grid_max_y = 3;
@@ -757,7 +757,7 @@ void MarlinSettings::postprocess() {
757 757
           set_bed_leveling_enabled(false);
758 758
           EEPROM_READ(bilinear_grid_spacing);        // 2 ints
759 759
           EEPROM_READ(bilinear_start);               // 2 ints
760
-          EEPROM_READ(bed_level_grid);               // 9 to 256 floats
760
+          EEPROM_READ(z_values);                     // 9 to 256 floats
761 761
         }
762 762
         else // EEPROM data is stale
763 763
       #endif // AUTO_BED_LEVELING_BILINEAR

Carregando…
Cancelar
Salvar