|
|
|
@ -929,15 +929,10 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
|
|
|
|
int moves_queued = movesplanned();
|
|
|
|
|
|
|
|
|
|
// Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill
|
|
|
|
|
#if ENABLED(OLD_SLOWDOWN) || ENABLED(SLOWDOWN)
|
|
|
|
|
bool mq = moves_queued > 1 && moves_queued < (BLOCK_BUFFER_SIZE) / 2;
|
|
|
|
|
#if ENABLED(OLD_SLOWDOWN)
|
|
|
|
|
if (mq) fr_mm_s *= 2.0 * moves_queued / (BLOCK_BUFFER_SIZE);
|
|
|
|
|
#endif
|
|
|
|
|
#if ENABLED(SLOWDOWN)
|
|
|
|
|
// segment time im micro seconds
|
|
|
|
|
unsigned long segment_time = lround(1000000.0/inverse_mm_s);
|
|
|
|
|
if (mq) {
|
|
|
|
|
// Segment time im micro seconds
|
|
|
|
|
unsigned long segment_time = lround(1000000.0 / inverse_mm_s);
|
|
|
|
|
if (moves_queued > 1 && moves_queued < (BLOCK_BUFFER_SIZE) / 2) {
|
|
|
|
|
if (segment_time < min_segment_time) {
|
|
|
|
|
// buffer is draining, add extra time. The amount of time added increases if the buffer is still emptied more.
|
|
|
|
|
inverse_mm_s = 1000000.0 / (segment_time + lround(2 * (min_segment_time - segment_time) / moves_queued));
|
|
|
|
@ -947,7 +942,6 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
block->nominal_speed = block->millimeters * inverse_mm_s; // (mm/sec) Always > 0
|
|
|
|
|
block->nominal_rate = ceil(block->step_event_count * inverse_mm_s); // (step/sec) Always > 0
|
|
|
|
|