Browse Source

Configurable SLOWDOWN divisor (#17171)

InsanityAutomation 5 years ago
parent
commit
775a4294fc
No account linked to committer's email address
2 changed files with 9 additions and 2 deletions
  1. 5
    1
      Marlin/Configuration_adv.h
  2. 4
    1
      Marlin/src/module/planner.cpp

+ 5
- 1
Marlin/Configuration_adv.h View File

753
 // Minimum time that a segment needs to take if the buffer is emptied
753
 // Minimum time that a segment needs to take if the buffer is emptied
754
 #define DEFAULT_MINSEGMENTTIME        20000   // (ms)
754
 #define DEFAULT_MINSEGMENTTIME        20000   // (ms)
755
 
755
 
756
-// If defined the movements slow down when the look ahead buffer is only half full
756
+// Slow down the machine if the look ahead buffer is (by default) half full.
757
+// Increase the slowdown divisor for larger buffer sizes.
757
 #define SLOWDOWN
758
 #define SLOWDOWN
759
+#if ENABLED(SLOWDOWN)
760
+  #define SLOWDOWN_DIVISOR 2
761
+#endif
758
 
762
 
759
 // Frequency limit
763
 // Frequency limit
760
 // See nophead's blog for more info
764
 // See nophead's blog for more info

+ 4
- 1
Marlin/src/module/planner.cpp View File

2041
   #endif
2041
   #endif
2042
 
2042
 
2043
   #if ENABLED(SLOWDOWN)
2043
   #if ENABLED(SLOWDOWN)
2044
-    if (WITHIN(moves_queued, 2, (BLOCK_BUFFER_SIZE) / 2 - 1)) {
2044
+    #ifndef SLOWDOWN_DIVISOR
2045
+      #define SLOWDOWN_DIVISOR 2
2046
+    #endif
2047
+    if (WITHIN(moves_queued, 2, (BLOCK_BUFFER_SIZE) / (SLOWDOWN_DIVISOR) - 1)) {
2045
       if (segment_time_us < settings.min_segment_time_us) {
2048
       if (segment_time_us < settings.min_segment_time_us) {
2046
         // buffer is draining, add extra time.  The amount of time added increases if the buffer is still emptied more.
2049
         // buffer is draining, add extra time.  The amount of time added increases if the buffer is still emptied more.
2047
         const uint32_t nst = segment_time_us + LROUND(2 * (settings.min_segment_time_us - segment_time_us) / moves_queued);
2050
         const uint32_t nst = segment_time_us + LROUND(2 * (settings.min_segment_time_us - segment_time_us) / moves_queued);

Loading…
Cancel
Save