🎨 Use float CEIL/FLOOR
This commit is contained in:
parent
3a888e956b
commit
5987a5464b
|
@ -1655,9 +1655,9 @@ void RTS::handleData() {
|
||||||
|
|
||||||
case AutolevelVal: {
|
case AutolevelVal: {
|
||||||
uint8_t meshPoint = (recdat.addr - AutolevelVal) / 2,
|
uint8_t meshPoint = (recdat.addr - AutolevelVal) / 2,
|
||||||
yPnt = floor(meshPoint / GRID_MAX_POINTS_X),
|
yPnt = meshPoint / (GRID_MAX_POINTS_X),
|
||||||
xPnt = meshPoint - (yPnt * GRID_MAX_POINTS_X);
|
xPnt = meshPoint - yPnt * (GRID_MAX_POINTS_X);
|
||||||
if (yPnt % 2 != 0) xPnt = (GRID_MAX_POINTS_X - 1) - xPnt; // zag row
|
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;
|
float meshVal = float(recdat.data[0] - (recdat.data[0] >= 32768 ? 65536 : 0)) / 1000;
|
||||||
|
|
||||||
|
|
|
@ -544,9 +544,9 @@ void FTMotion::loadBlockData(block_t * const current_block) {
|
||||||
const float T1 = (F_n - f_s) * oneOverAccel,
|
const float T1 = (F_n - f_s) * oneOverAccel,
|
||||||
T3 = (F_n - f_e) * oneOverAccel;
|
T3 = (F_n - f_e) * oneOverAccel;
|
||||||
|
|
||||||
N1 = ceil(T1 * (FTM_FS)); // Accel datapoints based on Hz frequency
|
N1 = CEIL(T1 * (FTM_FS)); // Accel datapoints based on Hz frequency
|
||||||
N2 = ceil(T2 * (FTM_FS)); // Coast
|
N2 = CEIL(T2 * (FTM_FS)); // Coast
|
||||||
N3 = ceil(T3 * (FTM_FS)); // Decel
|
N3 = CEIL(T3 * (FTM_FS)); // Decel
|
||||||
|
|
||||||
const float T1_P = N1 * (FTM_TS), // (s) Accel datapoints x timestep resolution
|
const float T1_P = N1 * (FTM_TS), // (s) Accel datapoints x timestep resolution
|
||||||
T2_P = N2 * (FTM_TS), // (s) Coast
|
T2_P = N2 * (FTM_TS), // (s) Coast
|
||||||
|
|
|
@ -3161,7 +3161,7 @@ void Stepper::init() {
|
||||||
factor2 += -7.58095488 * zeta2;
|
factor2 += -7.58095488 * zeta2;
|
||||||
const float zeta3 = zeta2 * zeta;
|
const float zeta3 = zeta2 * zeta;
|
||||||
factor2 += 43.073216 * zeta3;
|
factor2 += 43.073216 * zeta3;
|
||||||
factor2 = floor(factor2);
|
factor2 = FLOOR(factor2);
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool was_on = hal.isr_state();
|
const bool was_on = hal.isr_state();
|
||||||
|
|
Loading…
Reference in a new issue