From 5987a5464bc8622d77ab52990b88d5ae035074e1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 7 Jan 2024 19:34:34 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Use=20float=20CEIL/FLOOR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp | 6 +++--- Marlin/src/module/ft_motion.cpp | 6 +++--- Marlin/src/module/stepper.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp index 68581aeafd9b..01a2c4ebccdd 100644 --- a/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp +++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp @@ -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; diff --git a/Marlin/src/module/ft_motion.cpp b/Marlin/src/module/ft_motion.cpp index ba1361f922b8..447f372e6367 100644 --- a/Marlin/src/module/ft_motion.cpp +++ b/Marlin/src/module/ft_motion.cpp @@ -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 diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 9c1668619ba9..552b7cb34a6e 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -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();