|
@@ -1060,7 +1060,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
1060
|
1060
|
#endif
|
1061
|
1061
|
);
|
1062
|
1062
|
}
|
1063
|
|
- float inverse_millimeters = 1.0 / block->millimeters; // Inverse millimeters to remove multiple divides
|
|
1063
|
+ const float inverse_millimeters = 1.0 / block->millimeters; // Inverse millimeters to remove multiple divides
|
1064
|
1064
|
|
1065
|
1065
|
// Calculate moves/second for this move. No divide by zero due to previous checks.
|
1066
|
1066
|
float inverse_mm_s = fr_mm_s * inverse_millimeters;
|
|
@@ -1076,9 +1076,10 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
1076
|
1076
|
if (WITHIN(moves_queued, 2, (BLOCK_BUFFER_SIZE) / 2 - 1)) {
|
1077
|
1077
|
if (segment_time_us < min_segment_time_us) {
|
1078
|
1078
|
// buffer is draining, add extra time. The amount of time added increases if the buffer is still emptied more.
|
1079
|
|
- inverse_mm_s = 1000000.0 / (segment_time_us + LROUND(2 * (min_segment_time_us - segment_time_us) / moves_queued));
|
|
1079
|
+ const uint32_t nst = segment_time_us + LROUND(2 * (min_segment_time_us - segment_time_us) / moves_queued);
|
|
1080
|
+ inverse_mm_s = 1000000.0 / nst;
|
1080
|
1081
|
#if defined(XY_FREQUENCY_LIMIT) || ENABLED(ULTRA_LCD)
|
1081
|
|
- segment_time_us = LROUND(1000000.0 / inverse_mm_s);
|
|
1082
|
+ segment_time_us = nst;
|
1082
|
1083
|
#endif
|
1083
|
1084
|
}
|
1084
|
1085
|
}
|
|
@@ -1106,7 +1107,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
1106
|
1107
|
filwidth_delay_dist += delta_mm[E_AXIS];
|
1107
|
1108
|
|
1108
|
1109
|
// Only get new measurements on forward E movement
|
1109
|
|
- if (filwidth_e_count > 0.0001) {
|
|
1110
|
+ if (!UNEAR_ZERO(filwidth_e_count)) {
|
1110
|
1111
|
|
1111
|
1112
|
// Loop the delay distance counter (modulus by the mm length)
|
1112
|
1113
|
while (filwidth_delay_dist >= MMD_MM) filwidth_delay_dist -= MMD_MM;
|
|
@@ -1309,7 +1310,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
1309
|
1310
|
}
|
1310
|
1311
|
}
|
1311
|
1312
|
|
1312
|
|
- if (moves_queued > 1 && previous_nominal_speed > 0.0001) {
|
|
1313
|
+ if (moves_queued > 1 && !UNEAR_ZERO(previous_nominal_speed)) {
|
1313
|
1314
|
// Estimate a maximum velocity allowed at a joint of two successive segments.
|
1314
|
1315
|
// If this maximum velocity allowed is lower than the minimum of the entry / exit safe velocities,
|
1315
|
1316
|
// then the machine is not coasting anymore and the safe entry / exit velocities shall be used.
|
|
@@ -1320,7 +1321,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
1320
|
1321
|
// Pick the smaller of the nominal speeds. Higher speed shall not be achieved at the junction during coasting.
|
1321
|
1322
|
vmax_junction = prev_speed_larger ? block->nominal_speed : previous_nominal_speed;
|
1322
|
1323
|
// Factor to multiply the previous / current nominal velocities to get componentwise limited velocities.
|
1323
|
|
- float v_factor = 1.f;
|
|
1324
|
+ float v_factor = 1;
|
1324
|
1325
|
limited = 0;
|
1325
|
1326
|
// Now limit the jerk in all axes.
|
1326
|
1327
|
LOOP_XYZE(axis) {
|
|
@@ -1335,9 +1336,9 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
1335
|
1336
|
// Calculate jerk depending on whether the axis is coasting in the same direction or reversing.
|
1336
|
1337
|
const float jerk = (v_exit > v_entry)
|
1337
|
1338
|
? // coasting axis reversal
|
1338
|
|
- ( (v_entry > 0.f || v_exit < 0.f) ? (v_exit - v_entry) : max(v_exit, -v_entry) )
|
|
1339
|
+ ( (v_entry > 0 || v_exit < 0) ? (v_exit - v_entry) : max(v_exit, -v_entry) )
|
1339
|
1340
|
: // v_exit <= v_entry coasting axis reversal
|
1340
|
|
- ( (v_entry < 0.f || v_exit > 0.f) ? (v_entry - v_exit) : max(-v_exit, v_entry) );
|
|
1341
|
+ ( (v_entry < 0 || v_exit > 0) ? (v_entry - v_exit) : max(-v_exit, v_entry) );
|
1341
|
1342
|
|
1342
|
1343
|
if (jerk > max_jerk[axis]) {
|
1343
|
1344
|
v_factor *= max_jerk[axis] / jerk;
|