Bläddra i källkod

Toshiba Stepper Driver support

Tosh stepper drivers need to be driven slower, so the stepper code
was interleaved to separate the pin HIGH from the pin LOW. This adds
enough instructions to make it work, without needing nops.
Bo Herrmannsen 9 år sedan
förälder
incheckning
edfcf3b527
1 ändrade filer med 53 tillägg och 0 borttagningar
  1. 53
    0
      Marlin/stepper.cpp

+ 53
- 0
Marlin/stepper.cpp Visa fil

@@ -559,6 +559,58 @@ ISR(TIMER1_COMPA_vect)
559 559
       #endif //ADVANCE
560 560
 
561 561
         counter_x += current_block->steps_x;
562
+        #ifdef CONFIG_STEPPERS_TOSHIBA
563
+	/* The toshiba stepper controller require much longer pulses
564
+	 * tjerfore we 'stage' decompose the pulses between high, and
565
+	 * low instead of doing each in turn. The extra tests add enough
566
+	 * lag to allow it work with without needing NOPs */ 
567
+      if (counter_x > 0) {
568
+        WRITE(X_STEP_PIN, HIGH);
569
+      }
570
+
571
+      counter_y += current_block->steps_y;
572
+      if (counter_y > 0) {
573
+        WRITE(Y_STEP_PIN, HIGH);
574
+      }
575
+
576
+      counter_z += current_block->steps_z;
577
+      if (counter_z > 0) {
578
+        WRITE(Z_STEP_PIN, HIGH);
579
+      }
580
+
581
+      #ifndef ADVANCE
582
+        counter_e += current_block->steps_e;
583
+        if (counter_e > 0) {
584
+          WRITE_E_STEP(HIGH);
585
+        }
586
+      #endif //!ADVANCE
587
+
588
+      if (counter_x > 0) {
589
+        counter_x -= current_block->step_event_count;
590
+        count_position[X_AXIS]+=count_direction[X_AXIS];   
591
+        WRITE(X_STEP_PIN, LOW);
592
+      }
593
+
594
+      if (counter_y > 0) {
595
+        counter_y -= current_block->step_event_count;
596
+        count_position[Y_AXIS]+=count_direction[Y_AXIS];
597
+        WRITE(Y_STEP_PIN, LOW);
598
+      }
599
+
600
+      if (counter_z > 0) {
601
+        counter_z -= current_block->step_event_count;
602
+        count_position[Z_AXIS]+=count_direction[Z_AXIS];
603
+        WRITE(Z_STEP_PIN, LOW);
604
+      }
605
+
606
+      #ifndef ADVANCE
607
+        if (counter_e > 0) {
608
+          counter_e -= current_block->step_event_count;
609
+          count_position[E_AXIS]+=count_direction[E_AXIS];
610
+          WRITE_E_STEP(LOW);
611
+        }
612
+      #endif //!ADVANCE
613
+#else
562 614
         if (counter_x > 0) {
563 615
         #ifdef DUAL_X_CARRIAGE
564 616
           if (extruder_duplication_enabled){
@@ -635,6 +687,7 @@ ISR(TIMER1_COMPA_vect)
635 687
           WRITE_E_STEP(INVERT_E_STEP_PIN);
636 688
         }
637 689
       #endif //!ADVANCE
690
+      #endif
638 691
       step_events_completed += 1;
639 692
       if(step_events_completed >= current_block->step_event_count) break;
640 693
     }

Laddar…
Avbryt
Spara