|
@@ -147,7 +147,7 @@ static inline bool point_on_1st_row(const uint8_t i)
|
|
|
// The first row of points may not be fully reachable
|
|
|
// and the y values may be shortened a bit by the bed carriage
|
|
|
// pulling the belt up.
|
|
|
-static inline float point_weight_x(const uint8_t i, const uint8_t npts, const float &y)
|
|
|
+static inline float point_weight_x(const uint8_t i, const float &y)
|
|
|
{
|
|
|
float w = 1.f;
|
|
|
if (point_on_1st_row(i)) {
|
|
@@ -169,7 +169,7 @@ static inline float point_weight_x(const uint8_t i, const uint8_t npts, const fl
|
|
|
// The first row of points may not be fully reachable
|
|
|
// and the y values may be shortened a bit by the bed carriage
|
|
|
// pulling the belt up.
|
|
|
-static inline float point_weight_y(const uint8_t i, const uint8_t npts, const float &y)
|
|
|
+static inline float point_weight_y(const uint8_t i, const float &y)
|
|
|
{
|
|
|
float w = 1.f;
|
|
|
if (point_on_1st_row(i)) {
|
|
@@ -294,7 +294,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
|
|
|
(c == 0) ? 1.f :
|
|
|
((c == 2) ? (-s1 * measured_pts[2 * i]) :
|
|
|
(-c2 * measured_pts[2 * i + 1]));
|
|
|
- float w = point_weight_x(i, npts, measured_pts[2 * i + 1]);
|
|
|
+ float w = point_weight_x(i, measured_pts[2 * i + 1]);
|
|
|
acc += a * b * w;
|
|
|
}
|
|
|
// Second for the residuum in the y axis.
|
|
@@ -309,7 +309,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
|
|
|
(c == 1) ? 1.f :
|
|
|
((c == 2) ? ( c1 * measured_pts[2 * i]) :
|
|
|
(-s2 * measured_pts[2 * i + 1]));
|
|
|
- float w = point_weight_y(i, npts, measured_pts[2 * i + 1]);
|
|
|
+ float w = point_weight_y(i, measured_pts[2 * i + 1]);
|
|
|
acc += a * b * w;
|
|
|
}
|
|
|
}
|
|
@@ -325,7 +325,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
|
|
|
((r == 2) ? (-s1 * measured_pts[2 * i]) :
|
|
|
(-c2 * measured_pts[2 * i + 1])));
|
|
|
float fx = c1 * measured_pts[2 * i] - s2 * measured_pts[2 * i + 1] + cntr[0] - pgm_read_float(true_pts + i * 2);
|
|
|
- float w = point_weight_x(i, npts, measured_pts[2 * i + 1]);
|
|
|
+ float w = point_weight_x(i, measured_pts[2 * i + 1]);
|
|
|
acc += j * fx * w;
|
|
|
}
|
|
|
{
|
|
@@ -335,7 +335,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
|
|
|
((r == 2) ? ( c1 * measured_pts[2 * i]) :
|
|
|
(-s2 * measured_pts[2 * i + 1])));
|
|
|
float fy = s1 * measured_pts[2 * i] + c2 * measured_pts[2 * i + 1] + cntr[1] - pgm_read_float(true_pts + i * 2 + 1);
|
|
|
- float w = point_weight_y(i, npts, measured_pts[2 * i + 1]);
|
|
|
+ float w = point_weight_y(i, measured_pts[2 * i + 1]);
|
|
|
acc += j * fy * w;
|
|
|
}
|
|
|
}
|
|
@@ -456,7 +456,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
|
|
|
#ifdef SUPPORT_VERBOSITY
|
|
|
if(verbosity_level >= 20) SERIAL_ECHOPGM("Point on first row");
|
|
|
#endif // SUPPORT_VERBOSITY
|
|
|
- float w = point_weight_y(i, npts, measured_pts[2 * i + 1]);
|
|
|
+ float w = point_weight_y(i, measured_pts[2 * i + 1]);
|
|
|
if (sqrt(errX) > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_X ||
|
|
|
(w != 0.f && sqrt(errY) > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_Y)) {
|
|
|
result = BED_SKEW_OFFSET_DETECTION_FITTING_FAILED;
|
|
@@ -553,7 +553,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
|
|
|
for (int8_t i = 0; i < npts; ++ i) {
|
|
|
float x = vec_x[0] * measured_pts[i * 2] + vec_y[0] * measured_pts[i * 2 + 1];
|
|
|
float y = vec_x[1] * measured_pts[i * 2] + vec_y[1] * measured_pts[i * 2 + 1];
|
|
|
- float w = point_weight_x(i, npts, y);
|
|
|
+ float w = point_weight_x(i, y);
|
|
|
cntr[0] += w * (pgm_read_float(true_pts + i * 2) - x);
|
|
|
wx += w;
|
|
|
#ifdef SUPPORT_VERBOSITY
|
|
@@ -570,7 +570,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
|
|
|
MYSERIAL.print(wx);
|
|
|
}
|
|
|
#endif // SUPPORT_VERBOSITY
|
|
|
- w = point_weight_y(i, npts, y);
|
|
|
+ w = point_weight_y(i, y);
|
|
|
cntr[1] += w * (pgm_read_float(true_pts + i * 2 + 1) - y);
|
|
|
wy += w;
|
|
|
#ifdef SUPPORT_VERBOSITY
|