Remove unused code
This commit is contained in:
parent
a9d0cc5e56
commit
42c27cabde
|
|
@ -15,32 +15,6 @@ float mesh_bed_leveling::get_z(float x, float y) {
|
||||||
int i, j;
|
int i, j;
|
||||||
float s, t;
|
float s, t;
|
||||||
|
|
||||||
#if MESH_NUM_X_POINTS==3 && MESH_NUM_Y_POINTS==3
|
|
||||||
#define MESH_MID_X (0.5f*(MESH_MIN_X+MESH_MAX_X))
|
|
||||||
#define MESH_MID_Y (0.5f*(MESH_MIN_Y+MESH_MAX_Y))
|
|
||||||
if (x < MESH_MID_X) {
|
|
||||||
i = 0;
|
|
||||||
s = (x - MESH_MIN_X) / MESH_X_DIST;
|
|
||||||
if (s > 1.f)
|
|
||||||
s = 1.f;
|
|
||||||
} else {
|
|
||||||
i = 1;
|
|
||||||
s = (x - MESH_MID_X) / MESH_X_DIST;
|
|
||||||
if (s < 0)
|
|
||||||
s = 0;
|
|
||||||
}
|
|
||||||
if (y < MESH_MID_Y) {
|
|
||||||
j = 0;
|
|
||||||
t = (y - MESH_MIN_Y) / MESH_Y_DIST;
|
|
||||||
if (t > 1.f)
|
|
||||||
t = 1.f;
|
|
||||||
} else {
|
|
||||||
j = 1;
|
|
||||||
t = (y - MESH_MID_Y) / MESH_Y_DIST;
|
|
||||||
if (t < 0)
|
|
||||||
t = 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
i = int(floor((x - MESH_MIN_X) / MESH_X_DIST));
|
i = int(floor((x - MESH_MIN_X) / MESH_X_DIST));
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
@ -78,27 +52,12 @@ float mesh_bed_leveling::get_z(float x, float y) {
|
||||||
else if (t > 1.f)
|
else if (t > 1.f)
|
||||||
t = 1.f;
|
t = 1.f;
|
||||||
}
|
}
|
||||||
#endif /* MESH_NUM_X_POINTS==3 && MESH_NUM_Y_POINTS==3 */
|
|
||||||
|
|
||||||
float si = 1.f-s;
|
float si = 1.f-s;
|
||||||
float z0 = si * z_values[j ][i] + s * z_values[j ][i+1];
|
float z0 = si * z_values[j ][i] + s * z_values[j ][i+1];
|
||||||
float z1 = si * z_values[j+1][i] + s * z_values[j+1][i+1];
|
float z1 = si * z_values[j+1][i] + s * z_values[j+1][i+1];
|
||||||
return (1.f-t) * z0 + t * z1;
|
return (1.f-t) * z0 + t * z1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mesh_bed_leveling::select_x_index(float x) {
|
|
||||||
int i = 1;
|
|
||||||
while (x > get_x(i) && i < MESH_NUM_X_POINTS - 1) i++;
|
|
||||||
return i - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int mesh_bed_leveling::select_y_index(float y) {
|
|
||||||
int i = 1;
|
|
||||||
while (y > get_y(i) && i < MESH_NUM_Y_POINTS - 1) i++;
|
|
||||||
return i - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if MESH_NUM_X_POINTS>=5 && MESH_NUM_Y_POINTS>=5 && (MESH_NUM_X_POINTS&1)==1 && (MESH_NUM_Y_POINTS&1)==1
|
|
||||||
// Works for an odd number of MESH_NUM_X_POINTS and MESH_NUM_Y_POINTS
|
// Works for an odd number of MESH_NUM_X_POINTS and MESH_NUM_Y_POINTS
|
||||||
|
|
||||||
void mesh_bed_leveling::upsample_3x3()
|
void mesh_bed_leveling::upsample_3x3()
|
||||||
|
|
@ -143,7 +102,6 @@ void mesh_bed_leveling::upsample_3x3()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // (MESH_NUM_X_POINTS>=5 && MESH_NUM_Y_POINTS>=5 && (MESH_NUM_X_POINTS&1)==1 && (MESH_NUM_Y_POINTS&1)==1)
|
|
||||||
|
|
||||||
void mesh_bed_leveling::print() {
|
void mesh_bed_leveling::print() {
|
||||||
SERIAL_PROTOCOLLNPGM("Num X,Y: " STRINGIFY(MESH_NUM_X_POINTS) "," STRINGIFY(MESH_NUM_Y_POINTS));
|
SERIAL_PROTOCOLLNPGM("Num X,Y: " STRINGIFY(MESH_NUM_X_POINTS) "," STRINGIFY(MESH_NUM_Y_POINTS));
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,6 @@
|
||||||
|
|
||||||
#ifdef MESH_BED_LEVELING
|
#ifdef MESH_BED_LEVELING
|
||||||
|
|
||||||
#define MEAS_NUM_X_DIST (float(MESH_MAX_X - MESH_MIN_X)/float(MESH_MEAS_NUM_X_POINTS - 1))
|
|
||||||
#define MEAS_NUM_Y_DIST (float(MESH_MAX_Y - MESH_MIN_Y)/float(MESH_MEAS_NUM_Y_POINTS - 1))
|
|
||||||
|
|
||||||
#define MESH_X_DIST (float(MESH_MAX_X - MESH_MIN_X)/float(MESH_NUM_X_POINTS - 1))
|
#define MESH_X_DIST (float(MESH_MAX_X - MESH_MIN_X)/float(MESH_NUM_X_POINTS - 1))
|
||||||
#define MESH_Y_DIST (float(MESH_MAX_Y - MESH_MIN_Y)/float(MESH_NUM_Y_POINTS - 1))
|
#define MESH_Y_DIST (float(MESH_MAX_Y - MESH_MIN_Y)/float(MESH_NUM_Y_POINTS - 1))
|
||||||
|
|
||||||
|
|
@ -21,13 +18,7 @@ public:
|
||||||
static float get_y(int i) { return float(MESH_MIN_Y) + float(MESH_Y_DIST) * float(i); }
|
static float get_y(int i) { return float(MESH_MIN_Y) + float(MESH_Y_DIST) * float(i); }
|
||||||
float get_z(float x, float y);
|
float get_z(float x, float y);
|
||||||
void set_z(uint8_t ix, uint8_t iy, float z) { z_values[iy][ix] = z; }
|
void set_z(uint8_t ix, uint8_t iy, float z) { z_values[iy][ix] = z; }
|
||||||
|
|
||||||
int select_x_index(float x);
|
|
||||||
int select_y_index(float y);
|
|
||||||
|
|
||||||
#if MESH_NUM_X_POINTS>=5 && MESH_NUM_Y_POINTS>=5 && (MESH_NUM_X_POINTS&1)==1 && (MESH_NUM_Y_POINTS&1)==1
|
|
||||||
void upsample_3x3();
|
void upsample_3x3();
|
||||||
#endif
|
|
||||||
void print();
|
void print();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue