Apply LIMIT macro

This commit is contained in:
Scott Lahteine
2019-07-10 03:33:28 -05:00
parent 9817976375
commit ed0e6afacb
14 changed files with 31 additions and 34 deletions

View File

@ -369,10 +369,10 @@ float bilinear_z_offset(const float raw[XYZ]) {
cy1 = CELL_INDEX(Y, current_position[Y_AXIS]),
cx2 = CELL_INDEX(X, destination[X_AXIS]),
cy2 = CELL_INDEX(Y, destination[Y_AXIS]);
cx1 = constrain(cx1, 0, ABL_BG_POINTS_X - 2);
cy1 = constrain(cy1, 0, ABL_BG_POINTS_Y - 2);
cx2 = constrain(cx2, 0, ABL_BG_POINTS_X - 2);
cy2 = constrain(cy2, 0, ABL_BG_POINTS_Y - 2);
LIMIT(cx1, 0, ABL_BG_POINTS_X - 2);
LIMIT(cy1, 0, ABL_BG_POINTS_Y - 2);
LIMIT(cx2, 0, ABL_BG_POINTS_X - 2);
LIMIT(cy2, 0, ABL_BG_POINTS_Y - 2);
// Start and end in the same cell? No split needed.
if (cx1 == cx2 && cy1 == cy2) {

View File

@ -443,8 +443,8 @@
int8_t cell_xi = (raw[X_AXIS] - (MESH_MIN_X)) * (1.0f / (MESH_X_DIST)),
cell_yi = (raw[Y_AXIS] - (MESH_MIN_Y)) * (1.0f / (MESH_Y_DIST));
cell_xi = constrain(cell_xi, 0, (GRID_MAX_POINTS_X) - 1);
cell_yi = constrain(cell_yi, 0, (GRID_MAX_POINTS_Y) - 1);
LIMIT(cell_xi, 0, (GRID_MAX_POINTS_X) - 1);
LIMIT(cell_yi, 0, (GRID_MAX_POINTS_Y) - 1);
const float x0 = mesh_index_to_xpos(cell_xi), // 64 byte table lookup avoids mul+add
y0 = mesh_index_to_ypos(cell_yi);