Define GRID_MAX_POINTS

This commit is contained in:
Scott Lahteine 2017-05-11 23:22:35 -05:00
parent b17e2d3dcd
commit 233f824dd6
5 changed files with 17 additions and 20 deletions

View file

@ -836,4 +836,7 @@
#endif
#endif
// Shorthand
#define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
#endif // CONDITIONALS_POST_H

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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)