Browse Source

Apply MINIMUM_STEPPER_PULSE in stepper advance_isr

Scott Lahteine 8 years ago
parent
commit
426f662586
1 changed files with 11 additions and 0 deletions
  1. 11
    0
      Marlin/stepper.cpp

+ 11
- 0
Marlin/stepper.cpp View File

709
     // Step all E steppers that have steps
709
     // Step all E steppers that have steps
710
     for (uint8_t i = 0; i < step_loops; i++) {
710
     for (uint8_t i = 0; i < step_loops; i++) {
711
 
711
 
712
+      #if MINIMUM_STEPPER_PULSE > 0
713
+        static uint32_t pulse_start;
714
+        pulse_start = TCNT0;
715
+      #endif
716
+
712
       START_E_PULSE(0);
717
       START_E_PULSE(0);
713
       #if E_STEPPERS > 1
718
       #if E_STEPPERS > 1
714
         START_E_PULSE(1);
719
         START_E_PULSE(1);
720
         #endif
725
         #endif
721
       #endif
726
       #endif
722
 
727
 
728
+      // For a minimum pulse time wait before stopping pulses
729
+      #if MINIMUM_STEPPER_PULSE > 0
730
+        #define CYCLES_EATEN_BY_E 10
731
+        while ((uint32_t)(TCNT0 - pulse_start) < (MINIMUM_STEPPER_PULSE * (F_CPU / 1000000UL)) - CYCLES_EATEN_BY_E) { /* nada */ }
732
+      #endif
733
+
723
       STOP_E_PULSE(0);
734
       STOP_E_PULSE(0);
724
       #if E_STEPPERS > 1
735
       #if E_STEPPERS > 1
725
         STOP_E_PULSE(1);
736
         STOP_E_PULSE(1);

Loading…
Cancel
Save