Procházet zdrojové kódy

Merge pull request #208 from Enchiridion/Marlin_v1

Added support for dual Z axis stepper drivers
ErikZalm před 12 roky
rodič
revize
f062794a0d
4 změnil soubory, kde provedl 57 přidání a 2 odebrání
  1. 12
    0
      Marlin/Configuration_adv.h
  2. 7
    2
      Marlin/Marlin.h
  3. 4
    0
      Marlin/pins.h
  4. 34
    0
      Marlin/stepper.cpp

+ 12
- 0
Marlin/Configuration_adv.h Zobrazit soubor

@@ -78,6 +78,18 @@
78 78
 
79 79
 //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
80 80
 
81
+// A single Z stepper driver is usually used to drive 2 stepper motors.
82
+// Uncomment this define to utilize a separate stepper driver for each Z axis motor.
83
+// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used
84
+// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards.
85
+// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
86
+//#define Z_DUAL_STEPPER_DRIVERS
87
+
88
+#ifdef Z_DUAL_STEPPER_DRIVERS
89
+  #undef EXTRUDERS
90
+  #define EXTRUDERS 1
91
+#endif
92
+
81 93
 //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
82 94
 #define X_HOME_RETRACT_MM 5 
83 95
 #define Y_HOME_RETRACT_MM 5 

+ 7
- 2
Marlin/Marlin.h Zobrazit soubor

@@ -126,8 +126,13 @@ void manage_inactivity(byte debug);
126 126
 #endif
127 127
 
128 128
 #if Z_ENABLE_PIN > -1
129
-  #define  enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
130
-  #define disable_z() WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON)
129
+  #ifdef Z_DUAL_STEPPER_DRIVERS
130
+    #define  enable_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); }
131
+    #define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); }
132
+  #else
133
+    #define  enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
134
+    #define disable_z() WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON)
135
+  #endif
131 136
 #else
132 137
   #define enable_z() ;
133 138
   #define disable_z() ;

+ 4
- 0
Marlin/pins.h Zobrazit soubor

@@ -267,6 +267,10 @@
267 267
 #define Z_MIN_PIN          18
268 268
 #define Z_MAX_PIN          19
269 269
 
270
+#define Z2_STEP_PIN        36
271
+#define Z2_DIR_PIN         34
272
+#define Z2_ENABLE_PIN      30
273
+
270 274
 #define E0_STEP_PIN        26
271 275
 #define E0_DIR_PIN         28
272 276
 #define E0_ENABLE_PIN      24

+ 34
- 0
Marlin/stepper.cpp Zobrazit soubor

@@ -421,6 +421,11 @@ ISR(TIMER1_COMPA_vect)
421 421
     
422 422
     if ((out_bits & (1<<Z_AXIS)) != 0) {   // -direction
423 423
       WRITE(Z_DIR_PIN,INVERT_Z_DIR);
424
+      
425
+	  #ifdef Z_DUAL_STEPPER_DRIVERS
426
+        WRITE(Z2_DIR_PIN,INVERT_Z_DIR);
427
+      #endif
428
+      
424 429
       count_direction[Z_AXIS]=-1;
425 430
       CHECK_ENDSTOPS
426 431
       {
@@ -437,6 +442,11 @@ ISR(TIMER1_COMPA_vect)
437 442
     }
438 443
     else { // +direction
439 444
       WRITE(Z_DIR_PIN,!INVERT_Z_DIR);
445
+
446
+	  #ifdef Z_DUAL_STEPPER_DRIVERS
447
+        WRITE(Z2_DIR_PIN,!INVERT_Z_DIR);
448
+      #endif
449
+
440 450
       count_direction[Z_AXIS]=1;
441 451
       CHECK_ENDSTOPS
442 452
       {
@@ -552,9 +562,18 @@ ISR(TIMER1_COMPA_vect)
552 562
       counter_z += current_block->steps_z;
553 563
       if (counter_z > 0) {
554 564
         WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
565
+        
566
+		#ifdef Z_DUAL_STEPPER_DRIVERS
567
+          WRITE(Z2_STEP_PIN, !INVERT_Z_STEP_PIN);
568
+        #endif
569
+        
555 570
         counter_z -= current_block->step_event_count;
556 571
         count_position[Z_AXIS]+=count_direction[Z_AXIS];
557 572
         WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN);
573
+        
574
+		#ifdef Z_DUAL_STEPPER_DRIVERS
575
+          WRITE(Z2_STEP_PIN, INVERT_Z_STEP_PIN);
576
+        #endif
558 577
       }
559 578
 
560 579
       #ifndef ADVANCE
@@ -704,6 +723,10 @@ void st_init()
704 723
   #endif
705 724
   #if Z_DIR_PIN > -1 
706 725
     SET_OUTPUT(Z_DIR_PIN);
726
+
727
+    #if defined(Z_DUAL_STEPPER_DRIVERS) && (Z2_DIR_PIN > -1)
728
+      SET_OUTPUT(Z2_DIR_PIN);
729
+    #endif
707 730
   #endif
708 731
   #if E0_DIR_PIN > -1 
709 732
     SET_OUTPUT(E0_DIR_PIN);
@@ -728,6 +751,11 @@ void st_init()
728 751
   #if (Z_ENABLE_PIN > -1)
729 752
     SET_OUTPUT(Z_ENABLE_PIN);
730 753
     if(!Z_ENABLE_ON) WRITE(Z_ENABLE_PIN,HIGH);
754
+    
755
+    #if defined(Z_DUAL_STEPPER_DRIVERS) && (Z2_ENABLE_PIN > -1)
756
+      SET_OUTPUT(Z2_ENABLE_PIN);
757
+      if(!Z_ENABLE_ON) WRITE(Z2_ENABLE_PIN,HIGH);
758
+    #endif
731 759
   #endif
732 760
   #if (E0_ENABLE_PIN > -1)
733 761
     SET_OUTPUT(E0_ENABLE_PIN);
@@ -802,6 +830,12 @@ void st_init()
802 830
     SET_OUTPUT(Z_STEP_PIN);
803 831
     WRITE(Z_STEP_PIN,INVERT_Z_STEP_PIN);
804 832
     if(!Z_ENABLE_ON) WRITE(Z_ENABLE_PIN,HIGH);
833
+    
834
+    #if defined(Z_DUAL_STEPPER_DRIVERS) && (Z2_STEP_PIN > -1)
835
+      SET_OUTPUT(Z2_STEP_PIN);
836
+      WRITE(Z2_STEP_PIN,INVERT_Z_STEP_PIN);
837
+      if(!Z_ENABLE_ON) WRITE(Z2_ENABLE_PIN,HIGH);
838
+    #endif
805 839
   #endif  
806 840
   #if (E0_STEP_PIN > -1) 
807 841
     SET_OUTPUT(E0_STEP_PIN);

Loading…
Zrušit
Uložit