Browse Source

Add some commentary to stepper ISR

Scott Lahteine 9 years ago
parent
commit
4ec3d1ea58
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      Marlin/stepper.cpp

+ 6
- 1
Marlin/stepper.cpp View File

@@ -450,10 +450,12 @@ void Stepper::isr() {
450 450
       #define _APPLY_STEP(AXIS) AXIS ##_APPLY_STEP
451 451
       #define _INVERT_STEP_PIN(AXIS) INVERT_## AXIS ##_STEP_PIN
452 452
 
453
+      // Advance the Bresenham counter; start a pulse if the axis needs a step
453 454
       #define PULSE_START(AXIS) \
454 455
         _COUNTER(AXIS) += current_block->steps[_AXIS(AXIS)]; \
455 456
         if (_COUNTER(AXIS) > 0) { _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); }
456 457
 
458
+      // Stop an active pulse, reset the Bresenham counter, update the position
457 459
       #define PULSE_STOP(AXIS) \
458 460
         if (_COUNTER(AXIS) > 0) { \
459 461
           _COUNTER(AXIS) -= current_block->step_event_count; \
@@ -461,6 +463,7 @@ void Stepper::isr() {
461 463
           _APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
462 464
         }
463 465
 
466
+      // If a minimum pulse time was specified get the CPU clock
464 467
       #if MINIMUM_STEPPER_PULSE > 0
465 468
         static uint32_t pulse_start;
466 469
         pulse_start = TCNT0;
@@ -476,6 +479,7 @@ void Stepper::isr() {
476 479
         PULSE_START(Z);
477 480
       #endif
478 481
 
482
+      // For non-advance use linear interpolation for E also
479 483
       #if DISABLED(ADVANCE) && DISABLED(LIN_ADVANCE)
480 484
         #if ENABLED(MIXING_EXTRUDER)
481 485
           // Keep updating the single E axis
@@ -492,6 +496,7 @@ void Stepper::isr() {
492 496
         #endif
493 497
       #endif // !ADVANCE && !LIN_ADVANCE
494 498
 
499
+      // For a minimum pulse time wait before stopping pulses
495 500
       #if MINIMUM_STEPPER_PULSE > 0
496 501
         #define CYCLES_EATEN_BY_CODE 10
497 502
         while ((uint32_t)(TCNT0 - pulse_start) < (MINIMUM_STEPPER_PULSE * (F_CPU / 1000000UL)) - CYCLES_EATEN_BY_CODE) { /* nada */ }
@@ -532,7 +537,7 @@ void Stepper::isr() {
532 537
     }
533 538
 
534 539
     #if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
535
-      // If we have esteps to execute, fire the next ISR "now"
540
+      // If we have esteps to execute, fire the next advance_isr "now"
536 541
       if (e_steps[TOOL_E_INDEX]) OCR0A = TCNT0 + 2;
537 542
     #endif
538 543
 

Loading…
Cancel
Save