Add array indexIntoAB[xx][yy]

and use it.
This commit is contained in:
AnHardt 2015-08-06 13:46:05 +02:00 committed by Richard Wackerbarth
parent e2d69f66b2
commit 3d23424121

View file

@ -2561,6 +2561,7 @@ inline void gcode_G28() {
double eqnAMatrix[abl2 * 3], // "A" matrix of the linear system of equations double eqnAMatrix[abl2 * 3], // "A" matrix of the linear system of equations
eqnBVector[abl2], // "B" vector of Z points eqnBVector[abl2], // "B" vector of Z points
mean = 0.0; mean = 0.0;
int8_t indexIntoAB[auto_bed_leveling_grid_points][auto_bed_leveling_grid_points];
#endif // !DELTA #endif // !DELTA
int probePointCounter = 0; int probePointCounter = 0;
@ -2625,7 +2626,7 @@ inline void gcode_G28() {
bed_level[xCount][yCount] = measured_z + z_offset; bed_level[xCount][yCount] = measured_z + z_offset;
#endif #endif
probePointCounter++; indexIntoAB[xCount][yCount] = probePointCounter++;
idle(); idle();
@ -2679,7 +2680,7 @@ inline void gcode_G28() {
for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) { for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) { for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) {
int ind = yy * auto_bed_leveling_grid_points + xx; int ind = indexIntoAB[xx][yy];
float diff = eqnBVector[ind] - mean; float diff = eqnBVector[ind] - mean;
float x_tmp = eqnAMatrix[ind + 0 * abl2], float x_tmp = eqnAMatrix[ind + 0 * abl2],
@ -2705,7 +2706,7 @@ inline void gcode_G28() {
for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) { for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) { for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) {
int ind = yy * auto_bed_leveling_grid_points + xx; int ind = indexIntoAB[xx][yy];
float x_tmp = eqnAMatrix[ind + 0 * abl2], float x_tmp = eqnAMatrix[ind + 0 * abl2],
y_tmp = eqnAMatrix[ind + 1 * abl2], y_tmp = eqnAMatrix[ind + 1 * abl2],
z_tmp = 0; z_tmp = 0;