From 8a6f2c99056aeac6e33936b4b6b393178755a32a Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 2 Sep 2020 04:32:09 +0200 Subject: [PATCH] Apply gradual slowdown/speedup to all segments. --- Firmware/planner.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Firmware/planner.cpp b/Firmware/planner.cpp index 2615ef66e3..1e86fd312b 100644 --- a/Firmware/planner.cpp +++ b/Firmware/planner.cpp @@ -1029,12 +1029,10 @@ Having the real displacement of the head, we can calculate the total movement le #ifdef SLOWDOWN //FIXME Vojtech: Why moves_queued > 1? Why not >=1? // Can we somehow differentiate the filling of the buffer at the start of a g-code from a buffer draining situation? - if (moves_queued > 1 && moves_queued < (BLOCK_BUFFER_SIZE >> 1)) { + if (moves_queued > 1 && moves_queued < (BLOCK_BUFFER_SIZE - 1)) { // segment time in micro seconds - unsigned long segment_time = lround(1000000.0/inverse_second); - if (segment_time < cs.minsegmenttime) - // buffer is draining, add extra time. The amount of time added increases if the buffer is still emptied more. - inverse_second=1000000.0/(segment_time+lround(2*(cs.minsegmenttime-segment_time)/moves_queued)); + + inverse_second *= pow(0.85,(BLOCK_BUFFER_SIZE - moves_queued - 1)); } #endif // SLOWDOWN