Remove premature cast to int
This commit is contained in:
parent
7145bd085d
commit
dce6026e0e
@ -58,22 +58,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
int8_t cell_index_x(float x) {
|
int8_t cell_index_x(float x) {
|
||||||
int8_t cx = int(x - (MESH_MIN_X)) / (MESH_X_DIST);
|
int8_t cx = (x - (MESH_MIN_X)) / (MESH_X_DIST);
|
||||||
return constrain(cx, 0, (MESH_NUM_X_POINTS) - 2);
|
return constrain(cx, 0, (MESH_NUM_X_POINTS) - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t cell_index_y(float y) {
|
int8_t cell_index_y(float y) {
|
||||||
int8_t cy = int(y - (MESH_MIN_Y)) / (MESH_Y_DIST);
|
int8_t cy = (y - (MESH_MIN_Y)) / (MESH_Y_DIST);
|
||||||
return constrain(cy, 0, (MESH_NUM_Y_POINTS) - 2);
|
return constrain(cy, 0, (MESH_NUM_Y_POINTS) - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t probe_index_x(float x) {
|
int8_t probe_index_x(float x) {
|
||||||
int8_t px = int(x - (MESH_MIN_X) + (MESH_X_DIST) / 2) / (MESH_X_DIST);
|
int8_t px = (x - (MESH_MIN_X) + (MESH_X_DIST) * 0.5) / (MESH_X_DIST);
|
||||||
return (px >= 0 && px < (MESH_NUM_X_POINTS)) ? px : -1;
|
return (px >= 0 && px < (MESH_NUM_X_POINTS)) ? px : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t probe_index_y(float y) {
|
int8_t probe_index_y(float y) {
|
||||||
int8_t py = int(y - (MESH_MIN_Y) + (MESH_Y_DIST) / 2) / (MESH_Y_DIST);
|
int8_t py = (y - (MESH_MIN_Y) + (MESH_Y_DIST) * 0.5) / (MESH_Y_DIST);
|
||||||
return (py >= 0 && py < (MESH_NUM_Y_POINTS)) ? py : -1;
|
return (py >= 0 && py < (MESH_NUM_Y_POINTS)) ? py : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user