Reduce division in JD calc (#17945)
This commit is contained in:
parent
fcd1678a17
commit
e22e0763d9
|
@ -910,8 +910,12 @@ class Planner {
|
||||||
|
|
||||||
FORCE_INLINE static float limit_value_by_axis_maximum(const float &max_value, xyze_float_t &unit_vec) {
|
FORCE_INLINE static float limit_value_by_axis_maximum(const float &max_value, xyze_float_t &unit_vec) {
|
||||||
float limit_value = max_value;
|
float limit_value = max_value;
|
||||||
LOOP_XYZE(idx) if (unit_vec[idx]) // Avoid divide by zero
|
LOOP_XYZE(idx) {
|
||||||
NOMORE(limit_value, ABS(settings.max_acceleration_mm_per_s2[idx] / unit_vec[idx]));
|
if (unit_vec[idx]) {
|
||||||
|
if (limit_value * ABS(unit_vec[idx]) > settings.max_acceleration_mm_per_s2[idx])
|
||||||
|
limit_value = ABS(settings.max_acceleration_mm_per_s2[idx] / unit_vec[idx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
return limit_value;
|
return limit_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue