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