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,6 +709,11 @@ void Stepper::isr() {
709 709
     // Step all E steppers that have steps
710 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 717
       START_E_PULSE(0);
713 718
       #if E_STEPPERS > 1
714 719
         START_E_PULSE(1);
@@ -720,6 +725,12 @@ void Stepper::isr() {
720 725
         #endif
721 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 734
       STOP_E_PULSE(0);
724 735
       #if E_STEPPERS > 1
725 736
         STOP_E_PULSE(1);

Loading…
Cancel
Save