🎨 Use float CEIL/FLOOR

This commit is contained in:
Scott Lahteine 2024-01-07 19:34:34 -06:00
parent 3a888e956b
commit 5987a5464b
3 changed files with 7 additions and 7 deletions

View file

@ -1655,9 +1655,9 @@ void RTS::handleData() {
case AutolevelVal: {
uint8_t meshPoint = (recdat.addr - AutolevelVal) / 2,
yPnt = floor(meshPoint / GRID_MAX_POINTS_X),
xPnt = meshPoint - (yPnt * GRID_MAX_POINTS_X);
if (yPnt % 2 != 0) xPnt = (GRID_MAX_POINTS_X - 1) - xPnt; // zag row
yPnt = meshPoint / (GRID_MAX_POINTS_X),
xPnt = meshPoint - yPnt * (GRID_MAX_POINTS_X);
if (yPnt % 2 != 0) xPnt = (GRID_MAX_POINTS_X) - 1 - xPnt; // zag row
float meshVal = float(recdat.data[0] - (recdat.data[0] >= 32768 ? 65536 : 0)) / 1000;

View file

@ -544,9 +544,9 @@ void FTMotion::loadBlockData(block_t * const current_block) {
const float T1 = (F_n - f_s) * oneOverAccel,
T3 = (F_n - f_e) * oneOverAccel;
N1 = ceil(T1 * (FTM_FS)); // Accel datapoints based on Hz frequency
N2 = ceil(T2 * (FTM_FS)); // Coast
N3 = ceil(T3 * (FTM_FS)); // Decel
N1 = CEIL(T1 * (FTM_FS)); // Accel datapoints based on Hz frequency
N2 = CEIL(T2 * (FTM_FS)); // Coast
N3 = CEIL(T3 * (FTM_FS)); // Decel
const float T1_P = N1 * (FTM_TS), // (s) Accel datapoints x timestep resolution
T2_P = N2 * (FTM_TS), // (s) Coast

View file

@ -3161,7 +3161,7 @@ void Stepper::init() {
factor2 += -7.58095488 * zeta2;
const float zeta3 = zeta2 * zeta;
factor2 += 43.073216 * zeta3;
factor2 = floor(factor2);
factor2 = FLOOR(factor2);
}
const bool was_on = hal.isr_state();