Browse Source

Define GRID_MAX_POINTS

Scott Lahteine 8 years ago
parent
commit
233f824dd6
5 changed files with 17 additions and 20 deletions
  1. 3
    0
      Marlin/Conditionals_post.h
  2. 4
    6
      Marlin/Marlin_main.cpp
  3. 2
    2
      Marlin/configuration_store.cpp
  4. 2
    2
      Marlin/ubl_G29.cpp
  5. 6
    10
      Marlin/ultralcd.cpp

+ 3
- 0
Marlin/Conditionals_post.h View File

836
     #endif
836
     #endif
837
   #endif
837
   #endif
838
 
838
 
839
+  // Shorthand
840
+  #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
841
+
839
 #endif // CONDITIONALS_POST_H
842
 #endif // CONDITIONALS_POST_H

+ 4
- 6
Marlin/Marlin_main.cpp View File

4031
           #endif
4031
           #endif
4032
         }
4032
         }
4033
         // If there's another point to sample, move there with optional lift.
4033
         // If there's another point to sample, move there with optional lift.
4034
-        if (mbl_probe_index < (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)) {
4034
+        if (mbl_probe_index < GRID_MAX_POINTS) {
4035
           mbl.zigzag(mbl_probe_index, px, py);
4035
           mbl.zigzag(mbl_probe_index, px, py);
4036
           _manual_goto_xy(mbl.index_to_xpos[px], mbl.index_to_ypos[py]);
4036
           _manual_goto_xy(mbl.index_to_xpos[px], mbl.index_to_ypos[py]);
4037
 
4037
 
4250
       ABL_VAR int left_probe_bed_position, right_probe_bed_position, front_probe_bed_position, back_probe_bed_position;
4250
       ABL_VAR int left_probe_bed_position, right_probe_bed_position, front_probe_bed_position, back_probe_bed_position;
4251
       ABL_VAR float xGridSpacing, yGridSpacing;
4251
       ABL_VAR float xGridSpacing, yGridSpacing;
4252
 
4252
 
4253
-      #define ABL_GRID_MAX (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)
4254
-
4255
       #if ABL_PLANAR
4253
       #if ABL_PLANAR
4256
         ABL_VAR uint8_t abl_grid_points_x = GRID_MAX_POINTS_X,
4254
         ABL_VAR uint8_t abl_grid_points_x = GRID_MAX_POINTS_X,
4257
                         abl_grid_points_y = GRID_MAX_POINTS_Y;
4255
                         abl_grid_points_y = GRID_MAX_POINTS_Y;
4265
         #if ABL_PLANAR
4263
         #if ABL_PLANAR
4266
           ABL_VAR int abl2;
4264
           ABL_VAR int abl2;
4267
         #else // 3-point
4265
         #else // 3-point
4268
-          int constexpr abl2 = ABL_GRID_MAX;
4266
+          int constexpr abl2 = GRID_MAX_POINTS;
4269
         #endif
4267
         #endif
4270
       #endif
4268
       #endif
4271
 
4269
 
4277
 
4275
 
4278
         ABL_VAR int indexIntoAB[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
4276
         ABL_VAR int indexIntoAB[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
4279
 
4277
 
4280
-        ABL_VAR float eqnAMatrix[ABL_GRID_MAX * 3], // "A" matrix of the linear system of equations
4281
-                     eqnBVector[ABL_GRID_MAX],     // "B" vector of Z points
4278
+        ABL_VAR float eqnAMatrix[GRID_MAX_POINTS * 3], // "A" matrix of the linear system of equations
4279
+                     eqnBVector[GRID_MAX_POINTS],     // "B" vector of Z points
4282
                      mean;
4280
                      mean;
4283
       #endif
4281
       #endif
4284
 
4282
 

+ 2
- 2
Marlin/configuration_store.cpp View File

342
     #if ENABLED(MESH_BED_LEVELING)
342
     #if ENABLED(MESH_BED_LEVELING)
343
       // Compile time test that sizeof(mbl.z_values) is as expected
343
       // Compile time test that sizeof(mbl.z_values) is as expected
344
       static_assert(
344
       static_assert(
345
-        sizeof(mbl.z_values) == (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) * sizeof(mbl.z_values[0][0]),
345
+        sizeof(mbl.z_values) == GRID_MAX_POINTS * sizeof(mbl.z_values[0][0]),
346
         "MBL Z array is the wrong size."
346
         "MBL Z array is the wrong size."
347
       );
347
       );
348
       const bool leveling_is_on = TEST(mbl.status, MBL_STATUS_HAS_MESH_BIT);
348
       const bool leveling_is_on = TEST(mbl.status, MBL_STATUS_HAS_MESH_BIT);
386
     #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
386
     #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
387
       // Compile time test that sizeof(z_values) is as expected
387
       // Compile time test that sizeof(z_values) is as expected
388
       static_assert(
388
       static_assert(
389
-        sizeof(z_values) == (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) * sizeof(z_values[0][0]),
389
+        sizeof(z_values) == GRID_MAX_POINTS * sizeof(z_values[0][0]),
390
         "Bilinear Z array is the wrong size."
390
         "Bilinear Z array is the wrong size."
391
       );
391
       );
392
       const uint8_t grid_max_x = GRID_MAX_POINTS_X, grid_max_y = GRID_MAX_POINTS_Y;
392
       const uint8_t grid_max_x = GRID_MAX_POINTS_X, grid_max_y = GRID_MAX_POINTS_Y;

+ 2
- 2
Marlin/ubl_G29.cpp View File

1048
 
1048
 
1049
     repeat_flag = code_seen('R');
1049
     repeat_flag = code_seen('R');
1050
     if (repeat_flag) {
1050
     if (repeat_flag) {
1051
-      repetition_cnt = code_has_value() ? code_value_int() : (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y);
1052
-      repetition_cnt = min(repetition_cnt, (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y));
1051
+      repetition_cnt = code_has_value() ? code_value_int() : GRID_MAX_POINTS;
1052
+      NOMORE(repetition_cnt, GRID_MAX_POINTS);
1053
       if (repetition_cnt < 1) {
1053
       if (repetition_cnt < 1) {
1054
         SERIAL_PROTOCOLLNPGM("?(R)epetition count invalid (1+).\n");
1054
         SERIAL_PROTOCOLLNPGM("?(R)epetition count invalid (1+).\n");
1055
         return UBL_ERR;
1055
         return UBL_ERR;

+ 6
- 10
Marlin/ultralcd.cpp View File

1430
     #endif
1430
     #endif
1431
 
1431
 
1432
     // LCD probed points are from defaults
1432
     // LCD probed points are from defaults
1433
-    constexpr uint8_t total_probe_points =
1434
-      #if ABL_GRID
1435
-        (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)
1436
-      #elif ENABLED(AUTO_BED_LEVELING_3POINT)
1437
-        int(3)
1438
-      #elif ENABLED(AUTO_BED_LEVELING_UBL)
1439
-        (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)
1440
-      #elif ENABLED(MESH_BED_LEVELING)
1441
-        (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)
1433
+    constexpr uint8_t total_probe_points = (
1434
+      #if ENABLED(AUTO_BED_LEVELING_3POINT)
1435
+        3
1436
+      #elif ABL_GRID || ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(MESH_BED_LEVELING)
1437
+        GRID_MAX_POINTS
1442
       #endif
1438
       #endif
1443
-    ;
1439
+    );
1444
 
1440
 
1445
     #if ENABLED(MESH_BED_LEVELING)
1441
     #if ENABLED(MESH_BED_LEVELING)
1446
 
1442
 

Loading…
Cancel
Save