Przeglądaj źródła

Support step motor controllers with active low step pins.

daid 12 lat temu
rodzic
commit
12de8fff81
2 zmienionych plików z 20 dodań i 14 usunięć
  1. 6
    0
      Marlin/Configuration_adv.h
  2. 14
    14
      Marlin/stepper.cpp

+ 6
- 0
Marlin/Configuration_adv.h Wyświetl plik

@@ -88,6 +88,12 @@
88 88
 
89 89
 #define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
90 90
 
91
+//By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
92
+#define INVERT_X_STEP_PIN false
93
+#define INVERT_Y_STEP_PIN false
94
+#define INVERT_Z_STEP_PIN false
95
+#define INVERT_E_STEP_PIN false
96
+
91 97
 //default stepper release if idle
92 98
 #define DEFAULT_STEPPER_DEACTIVE_TIME 60
93 99
 

+ 14
- 14
Marlin/stepper.cpp Wyświetl plik

@@ -449,34 +449,34 @@ ISR(TIMER1_COMPA_vect)
449 449
       
450 450
       counter_x += current_block->steps_x;
451 451
       if (counter_x > 0) {
452
-        WRITE(X_STEP_PIN, HIGH);
452
+        WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
453 453
         counter_x -= current_block->step_event_count;
454
-        WRITE(X_STEP_PIN, LOW);
454
+        WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
455 455
         count_position[X_AXIS]+=count_direction[X_AXIS];   
456 456
       }
457 457
 
458 458
       counter_y += current_block->steps_y;
459 459
       if (counter_y > 0) {
460
-        WRITE(Y_STEP_PIN, HIGH);
460
+        WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
461 461
         counter_y -= current_block->step_event_count;
462
-        WRITE(Y_STEP_PIN, LOW);
462
+        WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
463 463
         count_position[Y_AXIS]+=count_direction[Y_AXIS];
464 464
       }
465 465
 
466 466
       counter_z += current_block->steps_z;
467 467
       if (counter_z > 0) {
468
-        WRITE(Z_STEP_PIN, HIGH);
468
+        WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
469 469
         counter_z -= current_block->step_event_count;
470
-        WRITE(Z_STEP_PIN, LOW);
470
+        WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN);
471 471
         count_position[Z_AXIS]+=count_direction[Z_AXIS];
472 472
       }
473 473
 
474 474
       #ifndef ADVANCE
475 475
         counter_e += current_block->steps_e;
476 476
         if (counter_e > 0) {
477
-          WRITE_E_STEP(HIGH);
477
+          WRITE_E_STEP(!INVERT_E_STEP_PIN);
478 478
           counter_e -= current_block->step_event_count;
479
-          WRITE_E_STEP(LOW);
479
+          WRITE_E_STEP(INVERT_E_STEP_PIN);
480 480
           count_position[E_AXIS]+=count_direction[E_AXIS];
481 481
         }
482 482
       #endif //!ADVANCE
@@ -704,27 +704,27 @@ void st_init()
704 704
   //Initialize Step Pins
705 705
   #if (X_STEP_PIN > -1) 
706 706
     SET_OUTPUT(X_STEP_PIN);
707
-    if(!X_ENABLE_ON) WRITE(X_ENABLE_PIN,HIGH);
707
+    WRITE(X_STEP_PIN,INVERT_X_STEP_PIN);
708 708
   #endif  
709 709
   #if (Y_STEP_PIN > -1) 
710 710
     SET_OUTPUT(Y_STEP_PIN);
711
-    if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH);
711
+    WRITE(Y_STEP_PIN,INVERT_Y_STEP_PIN);
712 712
   #endif  
713 713
   #if (Z_STEP_PIN > -1) 
714 714
     SET_OUTPUT(Z_STEP_PIN);
715
-    if(!Z_ENABLE_ON) WRITE(Z_ENABLE_PIN,HIGH);
715
+    WRITE(Z_STEP_PIN,INVERT_Z_STEP_PIN);
716 716
   #endif  
717 717
   #if (E0_STEP_PIN > -1) 
718 718
     SET_OUTPUT(E0_STEP_PIN);
719
-    if(!E_ENABLE_ON) WRITE(E0_ENABLE_PIN,HIGH);
719
+    WRITE(E0_STEP_PIN,INVERT_E_STEP_PIN);
720 720
   #endif  
721 721
   #if defined(E1_STEP_PIN) && (E1_STEP_PIN > -1) 
722 722
     SET_OUTPUT(E1_STEP_PIN);
723
-    if(!E_ENABLE_ON) WRITE(E1_ENABLE_PIN,HIGH);
723
+    WRITE(E1_STEP_PIN,INVERT_E_STEP_PIN);
724 724
   #endif  
725 725
   #if defined(E2_STEP_PIN) && (E2_STEP_PIN > -1) 
726 726
     SET_OUTPUT(E2_STEP_PIN);
727
-    if(!E_ENABLE_ON) WRITE(E2_ENABLE_PIN,HIGH);
727
+    WRITE(E2_STEP_PIN,INVERT_E_STEP_PIN);
728 728
   #endif  
729 729
 
730 730
   #ifdef CONTROLLERFAN_PIN

Ładowanie…
Anuluj
Zapisz