Skip to content

Commit

Permalink
Apply gradual slowdown/speedup to all segments.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkbel committed Sep 2, 2020
1 parent 7728446 commit 8a6f2c9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Firmware/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 8a6f2c9

Please sign in to comment.