diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 2a1f4e0b8e..5280da81a4 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -836,4 +836,7 @@ #endif #endif + // Shorthand + #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)) + #endif // CONDITIONALS_POST_H diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index adc2a903e2..cf13f15fda 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -4031,7 +4031,7 @@ void home_all_axes() { gcode_G28(); } #endif } // If there's another point to sample, move there with optional lift. - if (mbl_probe_index < (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)) { + if (mbl_probe_index < GRID_MAX_POINTS) { mbl.zigzag(mbl_probe_index, px, py); _manual_goto_xy(mbl.index_to_xpos[px], mbl.index_to_ypos[py]); @@ -4250,8 +4250,6 @@ void home_all_axes() { gcode_G28(); } ABL_VAR int left_probe_bed_position, right_probe_bed_position, front_probe_bed_position, back_probe_bed_position; ABL_VAR float xGridSpacing, yGridSpacing; - #define ABL_GRID_MAX (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) - #if ABL_PLANAR ABL_VAR uint8_t abl_grid_points_x = GRID_MAX_POINTS_X, abl_grid_points_y = GRID_MAX_POINTS_Y; @@ -4265,7 +4263,7 @@ void home_all_axes() { gcode_G28(); } #if ABL_PLANAR ABL_VAR int abl2; #else // 3-point - int constexpr abl2 = ABL_GRID_MAX; + int constexpr abl2 = GRID_MAX_POINTS; #endif #endif @@ -4277,8 +4275,8 @@ void home_all_axes() { gcode_G28(); } ABL_VAR int indexIntoAB[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; - ABL_VAR float eqnAMatrix[ABL_GRID_MAX * 3], // "A" matrix of the linear system of equations - eqnBVector[ABL_GRID_MAX], // "B" vector of Z points + ABL_VAR float eqnAMatrix[GRID_MAX_POINTS * 3], // "A" matrix of the linear system of equations + eqnBVector[GRID_MAX_POINTS], // "B" vector of Z points mean; #endif diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index fe815af2cb..201c03558f 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -342,7 +342,7 @@ void MarlinSettings::postprocess() { #if ENABLED(MESH_BED_LEVELING) // Compile time test that sizeof(mbl.z_values) is as expected static_assert( - sizeof(mbl.z_values) == (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) * sizeof(mbl.z_values[0][0]), + sizeof(mbl.z_values) == GRID_MAX_POINTS * sizeof(mbl.z_values[0][0]), "MBL Z array is the wrong size." ); const bool leveling_is_on = TEST(mbl.status, MBL_STATUS_HAS_MESH_BIT); @@ -386,7 +386,7 @@ void MarlinSettings::postprocess() { #if ENABLED(AUTO_BED_LEVELING_BILINEAR) // Compile time test that sizeof(z_values) is as expected static_assert( - sizeof(z_values) == (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) * sizeof(z_values[0][0]), + sizeof(z_values) == GRID_MAX_POINTS * sizeof(z_values[0][0]), "Bilinear Z array is the wrong size." ); const uint8_t grid_max_x = GRID_MAX_POINTS_X, grid_max_y = GRID_MAX_POINTS_Y; diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp index 2811821660..a44e9ee123 100644 --- a/Marlin/ubl_G29.cpp +++ b/Marlin/ubl_G29.cpp @@ -1048,8 +1048,8 @@ repeat_flag = code_seen('R'); if (repeat_flag) { - repetition_cnt = code_has_value() ? code_value_int() : (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y); - repetition_cnt = min(repetition_cnt, (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)); + repetition_cnt = code_has_value() ? code_value_int() : GRID_MAX_POINTS; + NOMORE(repetition_cnt, GRID_MAX_POINTS); if (repetition_cnt < 1) { SERIAL_PROTOCOLLNPGM("?(R)epetition count invalid (1+).\n"); return UBL_ERR; diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index f563c09ccc..a398a4fda6 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1430,17 +1430,13 @@ void kill_screen(const char* lcd_msg) { #endif // LCD probed points are from defaults - constexpr uint8_t total_probe_points = - #if ABL_GRID - (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) - #elif ENABLED(AUTO_BED_LEVELING_3POINT) - int(3) - #elif ENABLED(AUTO_BED_LEVELING_UBL) - (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) - #elif ENABLED(MESH_BED_LEVELING) - (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) + constexpr uint8_t total_probe_points = ( + #if ENABLED(AUTO_BED_LEVELING_3POINT) + 3 + #elif ABL_GRID || ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(MESH_BED_LEVELING) + GRID_MAX_POINTS #endif - ; + ); #if ENABLED(MESH_BED_LEVELING)