Propose simpler probe index methods
This commit is contained in:
parent
a1a5cb5393
commit
4955163959
1 changed files with 4 additions and 8 deletions
|
@ -64,17 +64,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t probe_index_x(float x) {
|
int8_t probe_index_x(float x) {
|
||||||
for (int8_t px = MESH_NUM_X_POINTS; px--;)
|
int8_t px = int(x - (MESH_MIN_X) + (MESH_X_DIST) / 2) / (MESH_X_DIST);
|
||||||
if (fabs(x - get_probe_x(px)) <= (MESH_X_DIST) / 2)
|
return (px >= 0 && px < (MESH_NUM_X_POINTS)) ? px : -1;
|
||||||
return px;
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t probe_index_y(float y) {
|
int8_t probe_index_y(float y) {
|
||||||
for (int8_t py = MESH_NUM_Y_POINTS; py--;)
|
int8_t py = int(y - (MESH_MIN_Y) + (MESH_Y_DIST) / 2) / (MESH_Y_DIST);
|
||||||
if (fabs(y - get_probe_y(py)) <= (MESH_Y_DIST) / 2)
|
return (py >= 0 && py < (MESH_NUM_Y_POINTS)) ? py : -1;
|
||||||
return py;
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float calc_z0(float a0, float a1, float z1, float a2, float z2) {
|
float calc_z0(float a0, float a1, float z1, float a2, float z2) {
|
||||||
|
|
Reference in a new issue