|
@@ -64,17 +64,13 @@
|
64
|
64
|
}
|
65
|
65
|
|
66
|
66
|
int8_t probe_index_x(float x) {
|
67
|
|
- for (int8_t px = MESH_NUM_X_POINTS; px--;)
|
68
|
|
- if (fabs(x - get_probe_x(px)) <= (MESH_X_DIST) / 2)
|
69
|
|
- return px;
|
70
|
|
- return -1;
|
|
67
|
+ int8_t px = int(x - (MESH_MIN_X) + (MESH_X_DIST) / 2) / (MESH_X_DIST);
|
|
68
|
+ return (px >= 0 && px < (MESH_NUM_X_POINTS)) ? px : -1;
|
71
|
69
|
}
|
72
|
70
|
|
73
|
71
|
int8_t probe_index_y(float y) {
|
74
|
|
- for (int8_t py = MESH_NUM_Y_POINTS; py--;)
|
75
|
|
- if (fabs(y - get_probe_y(py)) <= (MESH_Y_DIST) / 2)
|
76
|
|
- return py;
|
77
|
|
- return -1;
|
|
72
|
+ int8_t py = int(y - (MESH_MIN_Y) + (MESH_Y_DIST) / 2) / (MESH_Y_DIST);
|
|
73
|
+ return (py >= 0 && py < (MESH_NUM_Y_POINTS)) ? py : -1;
|
78
|
74
|
}
|
79
|
75
|
|
80
|
76
|
float calc_z0(float a0, float a1, float z1, float a2, float z2) {
|