Browse Source

Support step motor controllers with active low step pins.

daid 12 years ago
parent
commit
12de8fff81
2 changed files with 20 additions and 14 deletions
  1. 6
    0
      Marlin/Configuration_adv.h
  2. 14
    14
      Marlin/stepper.cpp

+ 6
- 0
Marlin/Configuration_adv.h View File

88
 
88
 
89
 #define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
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
 //default stepper release if idle
97
 //default stepper release if idle
92
 #define DEFAULT_STEPPER_DEACTIVE_TIME 60
98
 #define DEFAULT_STEPPER_DEACTIVE_TIME 60
93
 
99
 

+ 14
- 14
Marlin/stepper.cpp View File

449
       
449
       
450
       counter_x += current_block->steps_x;
450
       counter_x += current_block->steps_x;
451
       if (counter_x > 0) {
451
       if (counter_x > 0) {
452
-        WRITE(X_STEP_PIN, HIGH);
452
+        WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
453
         counter_x -= current_block->step_event_count;
453
         counter_x -= current_block->step_event_count;
454
-        WRITE(X_STEP_PIN, LOW);
454
+        WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
455
         count_position[X_AXIS]+=count_direction[X_AXIS];   
455
         count_position[X_AXIS]+=count_direction[X_AXIS];   
456
       }
456
       }
457
 
457
 
458
       counter_y += current_block->steps_y;
458
       counter_y += current_block->steps_y;
459
       if (counter_y > 0) {
459
       if (counter_y > 0) {
460
-        WRITE(Y_STEP_PIN, HIGH);
460
+        WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
461
         counter_y -= current_block->step_event_count;
461
         counter_y -= current_block->step_event_count;
462
-        WRITE(Y_STEP_PIN, LOW);
462
+        WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
463
         count_position[Y_AXIS]+=count_direction[Y_AXIS];
463
         count_position[Y_AXIS]+=count_direction[Y_AXIS];
464
       }
464
       }
465
 
465
 
466
       counter_z += current_block->steps_z;
466
       counter_z += current_block->steps_z;
467
       if (counter_z > 0) {
467
       if (counter_z > 0) {
468
-        WRITE(Z_STEP_PIN, HIGH);
468
+        WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
469
         counter_z -= current_block->step_event_count;
469
         counter_z -= current_block->step_event_count;
470
-        WRITE(Z_STEP_PIN, LOW);
470
+        WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN);
471
         count_position[Z_AXIS]+=count_direction[Z_AXIS];
471
         count_position[Z_AXIS]+=count_direction[Z_AXIS];
472
       }
472
       }
473
 
473
 
474
       #ifndef ADVANCE
474
       #ifndef ADVANCE
475
         counter_e += current_block->steps_e;
475
         counter_e += current_block->steps_e;
476
         if (counter_e > 0) {
476
         if (counter_e > 0) {
477
-          WRITE_E_STEP(HIGH);
477
+          WRITE_E_STEP(!INVERT_E_STEP_PIN);
478
           counter_e -= current_block->step_event_count;
478
           counter_e -= current_block->step_event_count;
479
-          WRITE_E_STEP(LOW);
479
+          WRITE_E_STEP(INVERT_E_STEP_PIN);
480
           count_position[E_AXIS]+=count_direction[E_AXIS];
480
           count_position[E_AXIS]+=count_direction[E_AXIS];
481
         }
481
         }
482
       #endif //!ADVANCE
482
       #endif //!ADVANCE
704
   //Initialize Step Pins
704
   //Initialize Step Pins
705
   #if (X_STEP_PIN > -1) 
705
   #if (X_STEP_PIN > -1) 
706
     SET_OUTPUT(X_STEP_PIN);
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
   #endif  
708
   #endif  
709
   #if (Y_STEP_PIN > -1) 
709
   #if (Y_STEP_PIN > -1) 
710
     SET_OUTPUT(Y_STEP_PIN);
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
   #endif  
712
   #endif  
713
   #if (Z_STEP_PIN > -1) 
713
   #if (Z_STEP_PIN > -1) 
714
     SET_OUTPUT(Z_STEP_PIN);
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
   #endif  
716
   #endif  
717
   #if (E0_STEP_PIN > -1) 
717
   #if (E0_STEP_PIN > -1) 
718
     SET_OUTPUT(E0_STEP_PIN);
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
   #endif  
720
   #endif  
721
   #if defined(E1_STEP_PIN) && (E1_STEP_PIN > -1) 
721
   #if defined(E1_STEP_PIN) && (E1_STEP_PIN > -1) 
722
     SET_OUTPUT(E1_STEP_PIN);
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
   #endif  
724
   #endif  
725
   #if defined(E2_STEP_PIN) && (E2_STEP_PIN > -1) 
725
   #if defined(E2_STEP_PIN) && (E2_STEP_PIN > -1) 
726
     SET_OUTPUT(E2_STEP_PIN);
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
   #endif  
728
   #endif  
729
 
729
 
730
   #ifdef CONTROLLERFAN_PIN
730
   #ifdef CONTROLLERFAN_PIN

Loading…
Cancel
Save