Browse Source

Merge pull request #4722 from thinkyhead/rc_minimum_stepper_pulse

MINIMUM_STEPPER_PULSE option
Scott Lahteine 8 years ago
parent
commit
a82a89bc58

+ 4
- 0
Marlin/Configuration_adv.h View File

533
 // Moves (or segments) with fewer steps than this will be joined with the next move
533
 // Moves (or segments) with fewer steps than this will be joined with the next move
534
 #define MIN_STEPS_PER_SEGMENT 6
534
 #define MIN_STEPS_PER_SEGMENT 6
535
 
535
 
536
+// The minimum pulse width (in µs) for stepping a stepper.
537
+// Set this if you find stepping unreliable, or if using a very fast CPU.
538
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
539
+
536
 // @section temperature
540
 // @section temperature
537
 
541
 
538
 // Control heater 0 and heater 1 in parallel.
542
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/Cartesio/Configuration_adv.h View File

533
 // Moves (or segments) with fewer steps than this will be joined with the next move
533
 // Moves (or segments) with fewer steps than this will be joined with the next move
534
 #define MIN_STEPS_PER_SEGMENT 6
534
 #define MIN_STEPS_PER_SEGMENT 6
535
 
535
 
536
+// The minimum pulse width (in µs) for stepping a stepper.
537
+// Set this if you find stepping unreliable, or if using a very fast CPU.
538
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
539
+
536
 // @section temperature
540
 // @section temperature
537
 
541
 
538
 // Control heater 0 and heater 1 in parallel.
542
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/Felix/Configuration_adv.h View File

533
 // Moves (or segments) with fewer steps than this will be joined with the next move
533
 // Moves (or segments) with fewer steps than this will be joined with the next move
534
 #define MIN_STEPS_PER_SEGMENT 6
534
 #define MIN_STEPS_PER_SEGMENT 6
535
 
535
 
536
+// The minimum pulse width (in µs) for stepping a stepper.
537
+// Set this if you find stepping unreliable, or if using a very fast CPU.
538
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
539
+
536
 // @section temperature
540
 // @section temperature
537
 
541
 
538
 // Control heater 0 and heater 1 in parallel.
542
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/Hephestos/Configuration_adv.h View File

533
 // Moves (or segments) with fewer steps than this will be joined with the next move
533
 // Moves (or segments) with fewer steps than this will be joined with the next move
534
 #define MIN_STEPS_PER_SEGMENT 6
534
 #define MIN_STEPS_PER_SEGMENT 6
535
 
535
 
536
+// The minimum pulse width (in µs) for stepping a stepper.
537
+// Set this if you find stepping unreliable, or if using a very fast CPU.
538
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
539
+
536
 // @section temperature
540
 // @section temperature
537
 
541
 
538
 // Control heater 0 and heater 1 in parallel.
542
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/Hephestos_2/Configuration_adv.h View File

533
 // Moves (or segments) with fewer steps than this will be joined with the next move
533
 // Moves (or segments) with fewer steps than this will be joined with the next move
534
 #define MIN_STEPS_PER_SEGMENT 6
534
 #define MIN_STEPS_PER_SEGMENT 6
535
 
535
 
536
+// The minimum pulse width (in µs) for stepping a stepper.
537
+// Set this if you find stepping unreliable, or if using a very fast CPU.
538
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
539
+
536
 // @section temperature
540
 // @section temperature
537
 
541
 
538
 // Control heater 0 and heater 1 in parallel.
542
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/K8200/Configuration_adv.h View File

539
 // Moves (or segments) with fewer steps than this will be joined with the next move
539
 // Moves (or segments) with fewer steps than this will be joined with the next move
540
 #define MIN_STEPS_PER_SEGMENT 3
540
 #define MIN_STEPS_PER_SEGMENT 3
541
 
541
 
542
+// The minimum pulse width (in µs) for stepping a stepper.
543
+// Set this if you find stepping unreliable, or if using a very fast CPU.
544
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
545
+
542
 // @section temperature
546
 // @section temperature
543
 
547
 
544
 // Control heater 0 and heater 1 in parallel.
548
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/K8400/Configuration_adv.h View File

533
 // Moves (or segments) with fewer steps than this will be joined with the next move
533
 // Moves (or segments) with fewer steps than this will be joined with the next move
534
 #define MIN_STEPS_PER_SEGMENT 6
534
 #define MIN_STEPS_PER_SEGMENT 6
535
 
535
 
536
+// The minimum pulse width (in µs) for stepping a stepper.
537
+// Set this if you find stepping unreliable, or if using a very fast CPU.
538
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
539
+
536
 // @section temperature
540
 // @section temperature
537
 
541
 
538
 // Control heater 0 and heater 1 in parallel.
542
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/RigidBot/Configuration_adv.h View File

533
 // Moves (or segments) with fewer steps than this will be joined with the next move
533
 // Moves (or segments) with fewer steps than this will be joined with the next move
534
 #define MIN_STEPS_PER_SEGMENT 6
534
 #define MIN_STEPS_PER_SEGMENT 6
535
 
535
 
536
+// The minimum pulse width (in µs) for stepping a stepper.
537
+// Set this if you find stepping unreliable, or if using a very fast CPU.
538
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
539
+
536
 // @section temperature
540
 // @section temperature
537
 
541
 
538
 // Control heater 0 and heater 1 in parallel.
542
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/SCARA/Configuration_adv.h View File

533
 // Moves (or segments) with fewer steps than this will be joined with the next move
533
 // Moves (or segments) with fewer steps than this will be joined with the next move
534
 #define MIN_STEPS_PER_SEGMENT 6
534
 #define MIN_STEPS_PER_SEGMENT 6
535
 
535
 
536
+// The minimum pulse width (in µs) for stepping a stepper.
537
+// Set this if you find stepping unreliable, or if using a very fast CPU.
538
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
539
+
536
 // @section temperature
540
 // @section temperature
537
 
541
 
538
 // Control heater 0 and heater 1 in parallel.
542
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/TAZ4/Configuration_adv.h View File

541
 // Moves (or segments) with fewer steps than this will be joined with the next move
541
 // Moves (or segments) with fewer steps than this will be joined with the next move
542
 #define MIN_STEPS_PER_SEGMENT 6
542
 #define MIN_STEPS_PER_SEGMENT 6
543
 
543
 
544
+// The minimum pulse width (in µs) for stepping a stepper.
545
+// Set this if you find stepping unreliable, or if using a very fast CPU.
546
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
547
+
544
 // @section temperature
548
 // @section temperature
545
 
549
 
546
 // Control heater 0 and heater 1 in parallel.
550
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/WITBOX/Configuration_adv.h View File

533
 // Moves (or segments) with fewer steps than this will be joined with the next move
533
 // Moves (or segments) with fewer steps than this will be joined with the next move
534
 #define MIN_STEPS_PER_SEGMENT 6
534
 #define MIN_STEPS_PER_SEGMENT 6
535
 
535
 
536
+// The minimum pulse width (in µs) for stepping a stepper.
537
+// Set this if you find stepping unreliable, or if using a very fast CPU.
538
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
539
+
536
 // @section temperature
540
 // @section temperature
537
 
541
 
538
 // Control heater 0 and heater 1 in parallel.
542
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/delta/biv2.5/Configuration_adv.h View File

535
 // Moves (or segments) with fewer steps than this will be joined with the next move
535
 // Moves (or segments) with fewer steps than this will be joined with the next move
536
 #define MIN_STEPS_PER_SEGMENT 6
536
 #define MIN_STEPS_PER_SEGMENT 6
537
 
537
 
538
+// The minimum pulse width (in µs) for stepping a stepper.
539
+// Set this if you find stepping unreliable, or if using a very fast CPU.
540
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
541
+
538
 // @section temperature
542
 // @section temperature
539
 
543
 
540
 // Control heater 0 and heater 1 in parallel.
544
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/delta/generic/Configuration_adv.h View File

535
 // Moves (or segments) with fewer steps than this will be joined with the next move
535
 // Moves (or segments) with fewer steps than this will be joined with the next move
536
 #define MIN_STEPS_PER_SEGMENT 6
536
 #define MIN_STEPS_PER_SEGMENT 6
537
 
537
 
538
+// The minimum pulse width (in µs) for stepping a stepper.
539
+// Set this if you find stepping unreliable, or if using a very fast CPU.
540
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
541
+
538
 // @section temperature
542
 // @section temperature
539
 
543
 
540
 // Control heater 0 and heater 1 in parallel.
544
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h View File

534
 // Moves (or segments) with fewer steps than this will be joined with the next move
534
 // Moves (or segments) with fewer steps than this will be joined with the next move
535
 #define MIN_STEPS_PER_SEGMENT 6
535
 #define MIN_STEPS_PER_SEGMENT 6
536
 
536
 
537
+// The minimum pulse width (in µs) for stepping a stepper.
538
+// Set this if you find stepping unreliable, or if using a very fast CPU.
539
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
540
+
537
 // @section temperature
541
 // @section temperature
538
 
542
 
539
 // Control heater 0 and heater 1 in parallel.
543
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h View File

539
 // Moves (or segments) with fewer steps than this will be joined with the next move
539
 // Moves (or segments) with fewer steps than this will be joined with the next move
540
 #define MIN_STEPS_PER_SEGMENT 6
540
 #define MIN_STEPS_PER_SEGMENT 6
541
 
541
 
542
+// The minimum pulse width (in µs) for stepping a stepper.
543
+// Set this if you find stepping unreliable, or if using a very fast CPU.
544
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
545
+
542
 // @section temperature
546
 // @section temperature
543
 
547
 
544
 // Control heater 0 and heater 1 in parallel.
548
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h View File

535
 // Moves (or segments) with fewer steps than this will be joined with the next move
535
 // Moves (or segments) with fewer steps than this will be joined with the next move
536
 #define MIN_STEPS_PER_SEGMENT 6
536
 #define MIN_STEPS_PER_SEGMENT 6
537
 
537
 
538
+// The minimum pulse width (in µs) for stepping a stepper.
539
+// Set this if you find stepping unreliable, or if using a very fast CPU.
540
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
541
+
538
 // @section temperature
542
 // @section temperature
539
 
543
 
540
 // Control heater 0 and heater 1 in parallel.
544
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/makibox/Configuration_adv.h View File

533
 // Moves (or segments) with fewer steps than this will be joined with the next move
533
 // Moves (or segments) with fewer steps than this will be joined with the next move
534
 #define MIN_STEPS_PER_SEGMENT 6
534
 #define MIN_STEPS_PER_SEGMENT 6
535
 
535
 
536
+// The minimum pulse width (in µs) for stepping a stepper.
537
+// Set this if you find stepping unreliable, or if using a very fast CPU.
538
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
539
+
536
 // @section temperature
540
 // @section temperature
537
 
541
 
538
 // Control heater 0 and heater 1 in parallel.
542
 // Control heater 0 and heater 1 in parallel.

+ 4
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

533
 // Moves (or segments) with fewer steps than this will be joined with the next move
533
 // Moves (or segments) with fewer steps than this will be joined with the next move
534
 #define MIN_STEPS_PER_SEGMENT 6
534
 #define MIN_STEPS_PER_SEGMENT 6
535
 
535
 
536
+// The minimum pulse width (in µs) for stepping a stepper.
537
+// Set this if you find stepping unreliable, or if using a very fast CPU.
538
+#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
539
+
536
 // @section temperature
540
 // @section temperature
537
 
541
 
538
 // Control heater 0 and heater 1 in parallel.
542
 // Control heater 0 and heater 1 in parallel.

+ 25
- 15
Marlin/stepper.cpp View File

449
       #define _APPLY_STEP(AXIS) AXIS ##_APPLY_STEP
449
       #define _APPLY_STEP(AXIS) AXIS ##_APPLY_STEP
450
       #define _INVERT_STEP_PIN(AXIS) INVERT_## AXIS ##_STEP_PIN
450
       #define _INVERT_STEP_PIN(AXIS) INVERT_## AXIS ##_STEP_PIN
451
 
451
 
452
-      #define STEP_ADD(AXIS) \
452
+      #define PULSE_START(AXIS) \
453
         _COUNTER(AXIS) += current_block->steps[_AXIS(AXIS)]; \
453
         _COUNTER(AXIS) += current_block->steps[_AXIS(AXIS)]; \
454
         if (_COUNTER(AXIS) > 0) { _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); }
454
         if (_COUNTER(AXIS) > 0) { _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); }
455
 
455
 
456
+      #define PULSE_STOP(AXIS) \
457
+        if (_COUNTER(AXIS) > 0) { \
458
+          _COUNTER(AXIS) -= current_block->step_event_count; \
459
+          count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
460
+          _APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
461
+        }
462
+
463
+      #if MINIMUM_STEPPER_PULSE > 0
464
+        static uint32_t pulse_start;
465
+        pulse_start = TCNT0;
466
+      #endif
467
+
456
       #if HAS_X_STEP
468
       #if HAS_X_STEP
457
-        STEP_ADD(X);
469
+        PULSE_START(X);
458
       #endif
470
       #endif
459
       #if HAS_Y_STEP
471
       #if HAS_Y_STEP
460
-        STEP_ADD(Y);
472
+        PULSE_START(Y);
461
       #endif
473
       #endif
462
       #if HAS_Z_STEP
474
       #if HAS_Z_STEP
463
-        STEP_ADD(Z);
475
+        PULSE_START(Z);
464
       #endif
476
       #endif
465
 
477
 
466
       #if DISABLED(ADVANCE) && DISABLED(LIN_ADVANCE)
478
       #if DISABLED(ADVANCE) && DISABLED(LIN_ADVANCE)
475
             if (counter_M[j] > 0) En_STEP_WRITE(j, !INVERT_E_STEP_PIN);
487
             if (counter_M[j] > 0) En_STEP_WRITE(j, !INVERT_E_STEP_PIN);
476
           }
488
           }
477
         #else // !MIXING_EXTRUDER
489
         #else // !MIXING_EXTRUDER
478
-          STEP_ADD(E);
490
+          PULSE_START(E);
479
         #endif
491
         #endif
480
       #endif // !ADVANCE && !LIN_ADVANCE
492
       #endif // !ADVANCE && !LIN_ADVANCE
481
 
493
 
482
-      #define STEP_IF_COUNTER(AXIS) \
483
-        if (_COUNTER(AXIS) > 0) { \
484
-          _COUNTER(AXIS) -= current_block->step_event_count; \
485
-          count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
486
-          _APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
487
-        }
494
+      #if MINIMUM_STEPPER_PULSE > 0
495
+        #define CYCLES_EATEN_BY_CODE 10
496
+        while ((uint32_t)(TCNT0 - pulse_start) < (MINIMUM_STEPPER_PULSE * (F_CPU / 1000000UL)) - CYCLES_EATEN_BY_CODE) { /* nada */ }
497
+      #endif
488
 
498
 
489
       #if HAS_X_STEP
499
       #if HAS_X_STEP
490
-        STEP_IF_COUNTER(X);
500
+        PULSE_STOP(X);
491
       #endif
501
       #endif
492
       #if HAS_Y_STEP
502
       #if HAS_Y_STEP
493
-        STEP_IF_COUNTER(Y);
503
+        PULSE_STOP(Y);
494
       #endif
504
       #endif
495
       #if HAS_Z_STEP
505
       #if HAS_Z_STEP
496
-        STEP_IF_COUNTER(Z);
506
+        PULSE_STOP(Z);
497
       #endif
507
       #endif
498
 
508
 
499
       #if DISABLED(ADVANCE) && DISABLED(LIN_ADVANCE)
509
       #if DISABLED(ADVANCE) && DISABLED(LIN_ADVANCE)
510
             }
520
             }
511
           }
521
           }
512
         #else // !MIXING_EXTRUDER
522
         #else // !MIXING_EXTRUDER
513
-          STEP_IF_COUNTER(E);
523
+          PULSE_STOP(E);
514
         #endif
524
         #endif
515
       #endif // !ADVANCE && !LIN_ADVANCE
525
       #endif // !ADVANCE && !LIN_ADVANCE
516
 
526
 

Loading…
Cancel
Save