Scott Lahteine 7 роки тому
джерело
коміт
233f824dd6

+ 3
- 0
Marlin/Conditionals_post.h Переглянути файл

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

+ 4
- 6
Marlin/Marlin_main.cpp Переглянути файл

@@ -4031,7 +4031,7 @@ void home_all_axes() { gcode_G28(); }
4031 4031
           #endif
4032 4032
         }
4033 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 4035
           mbl.zigzag(mbl_probe_index, px, py);
4036 4036
           _manual_goto_xy(mbl.index_to_xpos[px], mbl.index_to_ypos[py]);
4037 4037
 
@@ -4250,8 +4250,6 @@ void home_all_axes() { gcode_G28(); }
4250 4250
       ABL_VAR int left_probe_bed_position, right_probe_bed_position, front_probe_bed_position, back_probe_bed_position;
4251 4251
       ABL_VAR float xGridSpacing, yGridSpacing;
4252 4252
 
4253
-      #define ABL_GRID_MAX (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)
4254
-
4255 4253
       #if ABL_PLANAR
4256 4254
         ABL_VAR uint8_t abl_grid_points_x = GRID_MAX_POINTS_X,
4257 4255
                         abl_grid_points_y = GRID_MAX_POINTS_Y;
@@ -4265,7 +4263,7 @@ void home_all_axes() { gcode_G28(); }
4265 4263
         #if ABL_PLANAR
4266 4264
           ABL_VAR int abl2;
4267 4265
         #else // 3-point
4268
-          int constexpr abl2 = ABL_GRID_MAX;
4266
+          int constexpr abl2 = GRID_MAX_POINTS;
4269 4267
         #endif
4270 4268
       #endif
4271 4269
 
@@ -4277,8 +4275,8 @@ void home_all_axes() { gcode_G28(); }
4277 4275
 
4278 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 4280
                      mean;
4283 4281
       #endif
4284 4282
 

+ 2
- 2
Marlin/configuration_store.cpp Переглянути файл

@@ -342,7 +342,7 @@ void MarlinSettings::postprocess() {
342 342
     #if ENABLED(MESH_BED_LEVELING)
343 343
       // Compile time test that sizeof(mbl.z_values) is as expected
344 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 346
         "MBL Z array is the wrong size."
347 347
       );
348 348
       const bool leveling_is_on = TEST(mbl.status, MBL_STATUS_HAS_MESH_BIT);
@@ -386,7 +386,7 @@ void MarlinSettings::postprocess() {
386 386
     #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
387 387
       // Compile time test that sizeof(z_values) is as expected
388 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 390
         "Bilinear Z array is the wrong size."
391 391
       );
392 392
       const uint8_t grid_max_x = GRID_MAX_POINTS_X, grid_max_y = GRID_MAX_POINTS_Y;

+ 2
- 2
Marlin/ubl_G29.cpp Переглянути файл

@@ -1048,8 +1048,8 @@
1048 1048
 
1049 1049
     repeat_flag = code_seen('R');
1050 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 1053
       if (repetition_cnt < 1) {
1054 1054
         SERIAL_PROTOCOLLNPGM("?(R)epetition count invalid (1+).\n");
1055 1055
         return UBL_ERR;

+ 6
- 10
Marlin/ultralcd.cpp Переглянути файл

@@ -1430,17 +1430,13 @@ void kill_screen(const char* lcd_msg) {
1430 1430
     #endif
1431 1431
 
1432 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 1438
       #endif
1443
-    ;
1439
+    );
1444 1440
 
1445 1441
     #if ENABLED(MESH_BED_LEVELING)
1446 1442
 

Завантаження…
Відмінити
Зберегти