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
#endif #endif
// Shorthand
#define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
#endif // CONDITIONALS_POST_H #endif // CONDITIONALS_POST_H

View File

@ -4031,7 +4031,7 @@ void home_all_axes() { gcode_G28(); }
#endif #endif
} }
// If there's another point to sample, move there with optional lift. // 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); mbl.zigzag(mbl_probe_index, px, py);
_manual_goto_xy(mbl.index_to_xpos[px], mbl.index_to_ypos[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 int left_probe_bed_position, right_probe_bed_position, front_probe_bed_position, back_probe_bed_position;
ABL_VAR float xGridSpacing, yGridSpacing; ABL_VAR float xGridSpacing, yGridSpacing;
#define ABL_GRID_MAX (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)
#if ABL_PLANAR #if ABL_PLANAR
ABL_VAR uint8_t abl_grid_points_x = GRID_MAX_POINTS_X, ABL_VAR uint8_t abl_grid_points_x = GRID_MAX_POINTS_X,
abl_grid_points_y = GRID_MAX_POINTS_Y; abl_grid_points_y = GRID_MAX_POINTS_Y;
@ -4265,7 +4263,7 @@ void home_all_axes() { gcode_G28(); }
#if ABL_PLANAR #if ABL_PLANAR
ABL_VAR int abl2; ABL_VAR int abl2;
#else // 3-point #else // 3-point
int constexpr abl2 = ABL_GRID_MAX; int constexpr abl2 = GRID_MAX_POINTS;
#endif #endif
#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 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 ABL_VAR float eqnAMatrix[GRID_MAX_POINTS * 3], // "A" matrix of the linear system of equations
eqnBVector[ABL_GRID_MAX], // "B" vector of Z points eqnBVector[GRID_MAX_POINTS], // "B" vector of Z points
mean; mean;
#endif #endif

View File

@ -342,7 +342,7 @@ void MarlinSettings::postprocess() {
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
// Compile time test that sizeof(mbl.z_values) is as expected // Compile time test that sizeof(mbl.z_values) is as expected
static_assert( 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." "MBL Z array is the wrong size."
); );
const bool leveling_is_on = TEST(mbl.status, MBL_STATUS_HAS_MESH_BIT); 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) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Compile time test that sizeof(z_values) is as expected // Compile time test that sizeof(z_values) is as expected
static_assert( 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." "Bilinear Z array is the wrong size."
); );
const uint8_t grid_max_x = GRID_MAX_POINTS_X, grid_max_y = GRID_MAX_POINTS_Y; 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'); repeat_flag = code_seen('R');
if (repeat_flag) { if (repeat_flag) {
repetition_cnt = code_has_value() ? code_value_int() : (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y); repetition_cnt = code_has_value() ? code_value_int() : GRID_MAX_POINTS;
repetition_cnt = min(repetition_cnt, (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)); NOMORE(repetition_cnt, GRID_MAX_POINTS);
if (repetition_cnt < 1) { if (repetition_cnt < 1) {
SERIAL_PROTOCOLLNPGM("?(R)epetition count invalid (1+).\n"); SERIAL_PROTOCOLLNPGM("?(R)epetition count invalid (1+).\n");
return UBL_ERR; return UBL_ERR;

View File

@ -1430,17 +1430,13 @@ void kill_screen(const char* lcd_msg) {
#endif #endif
// LCD probed points are from defaults // LCD probed points are from defaults
constexpr uint8_t total_probe_points = constexpr uint8_t total_probe_points = (
#if ABL_GRID #if ENABLED(AUTO_BED_LEVELING_3POINT)
(GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) 3
#elif ENABLED(AUTO_BED_LEVELING_3POINT) #elif ABL_GRID || ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(MESH_BED_LEVELING)
int(3) GRID_MAX_POINTS
#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)
#endif #endif
; );
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)