Browse Source

Merge pull request #1 from illuminarti/Fix_E_Speed

Fix step rate bug (especially for retraction)
daid 11 years ago
parent
commit
92782f9252
1 changed files with 5 additions and 0 deletions
  1. 5
    0
      Marlin/stepper.cpp

+ 5
- 0
Marlin/stepper.cpp View File

62
 static unsigned short acc_step_rate; // needed for deccelaration start point
62
 static unsigned short acc_step_rate; // needed for deccelaration start point
63
 static char step_loops;
63
 static char step_loops;
64
 static unsigned short OCR1A_nominal;
64
 static unsigned short OCR1A_nominal;
65
+static unsigned short step_loops_nominal;
65
 
66
 
66
 volatile long endstops_trigsteps[3]={0,0,0};
67
 volatile long endstops_trigsteps[3]={0,0,0};
67
 volatile long endstops_stepsTotal,endstops_stepsDone;
68
 volatile long endstops_stepsTotal,endstops_stepsDone;
288
   deceleration_time = 0;
289
   deceleration_time = 0;
289
   // step_rate to timer interval
290
   // step_rate to timer interval
290
   OCR1A_nominal = calc_timer(current_block->nominal_rate);
291
   OCR1A_nominal = calc_timer(current_block->nominal_rate);
292
+  // make a note of the number of step loops required at nominal speed
293
+  step_loops_nominal = step_loops;
291
   acc_step_rate = current_block->initial_rate;
294
   acc_step_rate = current_block->initial_rate;
292
   acceleration_time = calc_timer(acc_step_rate);
295
   acceleration_time = calc_timer(acc_step_rate);
293
   OCR1A = acceleration_time;
296
   OCR1A = acceleration_time;
665
     }
668
     }
666
     else {
669
     else {
667
       OCR1A = OCR1A_nominal;
670
       OCR1A = OCR1A_nominal;
671
+      // ensure we're running at the correct step rate, even if we just came off an acceleration
672
+      step_loops = step_loops_nominal;
668
     }
673
     }
669
 
674
 
670
     // If current block is finished, reset pointer 
675
     // If current block is finished, reset pointer 

Loading…
Cancel
Save