Skip to content

Commit

Permalink
🎨 Use float CEIL/FLOOR
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jan 8, 2024
1 parent 3a888e9 commit 5987a54
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/module/ft_motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 5987a54

Please sign in to comment.