|
@@ -54,15 +54,13 @@
|
54
|
54
|
}
|
55
|
55
|
|
56
|
56
|
int8_t cel_index_x(float x) {
|
57
|
|
- int8_t cx = 1;
|
58
|
|
- while (x > get_probe_x(cx) && cx < MESH_NUM_X_POINTS - 1) cx++; // For 3x3 range is 1 to 2
|
59
|
|
- return cx - 1; // so this will return 0 - 1
|
|
57
|
+ int8_t cx = int(x - (MESH_MIN_X)) / (MESH_X_DIST);
|
|
58
|
+ return constrain(cx, 0, (MESH_NUM_X_POINTS) - 2);
|
60
|
59
|
}
|
61
|
60
|
|
62
|
61
|
int8_t cel_index_y(float y) {
|
63
|
|
- int8_t cy = 1;
|
64
|
|
- while (y > get_probe_y(cy) && cy < MESH_NUM_Y_POINTS - 1) cy++;
|
65
|
|
- return cy - 1;
|
|
62
|
+ int8_t cy = int(y - (MESH_MIN_Y)) / (MESH_Y_DIST);
|
|
63
|
+ return constrain(cy, 0, (MESH_NUM_Y_POINTS) - 2);
|
66
|
64
|
}
|
67
|
65
|
|
68
|
66
|
int8_t probe_index_x(float x) {
|