Browse Source

Added slowdown

Erik van der Zalm 13 years ago
parent
commit
95126c09c0
2 changed files with 23 additions and 14 deletions
  1. 5
    2
      Marlin/Configuration.h
  2. 18
    12
      Marlin/planner.cpp

+ 5
- 2
Marlin/Configuration.h View File

18
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
18
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
19
 #define MINIMUM_PLANNER_SPEED 2.0 // (mm/sec)
19
 #define MINIMUM_PLANNER_SPEED 2.0 // (mm/sec)
20
 
20
 
21
+// If defined the movements slow down when the look ahead buffer is only half full
22
+#define SLOWDOWN
23
+
21
 // BASIC SETTINGS: select your board type, thermistor type, axis scaling, and endstop configuration
24
 // BASIC SETTINGS: select your board type, thermistor type, axis scaling, and endstop configuration
22
 
25
 
23
 //// The following define selects which electronics board you have. Please choose the one that matches your setup
26
 //// The following define selects which electronics board you have. Please choose the one that matches your setup
210
 #define DEFAULT_MINTRAVELFEEDRATE     0
213
 #define DEFAULT_MINTRAVELFEEDRATE     0
211
 
214
 
212
 // minimum time in microseconds that a movement needs to take if the buffer is emptied.   Increase this number if you see blobs while printing high speed & high detail.  It will slowdown on the detailed stuff.
215
 // minimum time in microseconds that a movement needs to take if the buffer is emptied.   Increase this number if you see blobs while printing high speed & high detail.  It will slowdown on the detailed stuff.
213
-#define DEFAULT_MINSEGMENTTIME        20000
216
+#define DEFAULT_MINSEGMENTTIME        20000   // Obsolete delete this
214
 #define DEFAULT_XYJERK                30.0    // (mm/sec)
217
 #define DEFAULT_XYJERK                30.0    // (mm/sec)
215
 #define DEFAULT_ZJERK                 0.4     // (mm/sec)
218
 #define DEFAULT_ZJERK                 0.4     // (mm/sec)
216
 
219
 
269
 
272
 
270
 #define ULTIPANEL
273
 #define ULTIPANEL
271
 #ifdef ULTIPANEL
274
 #ifdef ULTIPANEL
272
-  #define NEWPANEL  //enable this if you have a click-encoder panel
275
+//  #define NEWPANEL  //enable this if you have a click-encoder panel
273
   #define SDSUPPORT
276
   #define SDSUPPORT
274
   #define ULTRA_LCD
277
   #define ULTRA_LCD
275
   #define LCD_WIDTH 20
278
   #define LCD_WIDTH 20

+ 18
- 12
Marlin/planner.cpp View File

499
   block->nominal_speed = block->millimeters * inverse_second; // (mm/sec) Always > 0
499
   block->nominal_speed = block->millimeters * inverse_second; // (mm/sec) Always > 0
500
   block->nominal_rate = ceil(block->step_event_count * inverse_second); // (step/sec) Always > 0
500
   block->nominal_rate = ceil(block->step_event_count * inverse_second); // (step/sec) Always > 0
501
 
501
 
502
-//  unsigned long microseconds;
503
-#if 0
502
+  //  segment time im micro seconds
503
+  long segment_time = lround(1000000.0/inverse_second);
504
+ 
505
+ 
504
   if (block->steps_e == 0) {
506
   if (block->steps_e == 0) {
505
         if(feed_rate<mintravelfeedrate) feed_rate=mintravelfeedrate;
507
         if(feed_rate<mintravelfeedrate) feed_rate=mintravelfeedrate;
506
   }
508
   }
507
   else {
509
   else {
508
     	if(feed_rate<minimumfeedrate) feed_rate=minimumfeedrate;
510
     	if(feed_rate<minimumfeedrate) feed_rate=minimumfeedrate;
509
   } 
511
   } 
512
+  
513
+#ifdef SLOWDOWN
514
+  // slow down when de buffer starts to empty, rather than wait at the corner for a buffer refill
515
+  int moves_queued=(block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
516
+  
517
+  if(moves_queued < (BLOCK_BUFFER_SIZE * 0.5)) feed_rate = feed_rate / ((BLOCK_BUFFER_SIZE * 0.5)/moves_queued); 
518
+#endif
510
 
519
 
511
-  microseconds = lround((block->millimeters/feed_rate)*1000000);
520
+/*
512
 
521
 
513
-  // slow down when de buffer starts to empty, rather than wait at the corner for a buffer refill
514
-  // reduces/removes corner blobs as the machine won't come to a full stop.
515
-  int blockcount=(block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
516
   
522
   
517
   if ((blockcount>0) && (blockcount < (BLOCK_BUFFER_SIZE - 4))) {
523
   if ((blockcount>0) && (blockcount < (BLOCK_BUFFER_SIZE - 4))) {
518
-    if (microseconds<minsegmenttime)  { // buffer is draining, add extra time.  The amount of time added increases if the buffer is still emptied more.
519
-        microseconds=microseconds+lround(2*(minsegmenttime-microseconds)/blockcount);
524
+    if (segment_time<minsegmenttime)  { // buffer is draining, add extra time.  The amount of time added increases if the buffer is still emptied more.
525
+        segment_time=segment_time+lround(2*(minsegmenttime-segment_time)/blockcount);
520
     }
526
     }
521
   }
527
   }
522
   else {
528
   else {
523
-    if (microseconds<minsegmenttime) microseconds=minsegmenttime;
529
+    if (segment_time<minsegmenttime) segment_time=minsegmenttime;
524
   }
530
   }
525
-  //  END OF SLOW DOWN SECTION  
526
-#endif  
531
+  //  END OF SLOW DOWN SECTION    
532
+*/
527
 
533
 
528
  // Calculate speed in mm/sec for each axis
534
  // Calculate speed in mm/sec for each axis
529
   float current_speed[4];
535
   float current_speed[4];
546
   // Check and limit the xy direction change frequency
552
   // Check and limit the xy direction change frequency
547
   unsigned char direction_change = block->direction_bits ^ old_direction_bits;
553
   unsigned char direction_change = block->direction_bits ^ old_direction_bits;
548
   old_direction_bits = block->direction_bits;
554
   old_direction_bits = block->direction_bits;
549
-  long segment_time = lround(1000000.0/inverse_second);
555
+
550
   if((direction_change & (1<<X_AXIS)) == 0) {
556
   if((direction_change & (1<<X_AXIS)) == 0) {
551
      x_segment_time[0] += segment_time;
557
      x_segment_time[0] += segment_time;
552
   }
558
   }

Loading…
Cancel
Save