Browse Source

Fix stepper direction macros, multi-nozzle scope (#13569)

InsanityAutomation 5 years ago
parent
commit
d44e5b1fde
3 changed files with 17 additions and 14 deletions
  1. 3
    4
      Marlin/src/module/motion.cpp
  2. 3
    4
      Marlin/src/module/motion.h
  3. 11
    6
      Marlin/src/module/stepper_indirection.h

+ 3
- 4
Marlin/src/module/motion.cpp View File

@@ -859,10 +859,9 @@ void clean_up_after_endstop_or_probe_move() {
859 859
 #if HAS_DUPLICATION_MODE
860 860
   bool extruder_duplication_enabled,
861 861
        mirrored_duplication_mode;
862
-#endif
863
-
864
-#if ENABLED(MULTI_NOZZLE_DUPLICATION) && HOTENDS > 2
865
-  uint8_t duplication_e_mask; // = 0
862
+  #if ENABLED(MULTI_NOZZLE_DUPLICATION)
863
+    uint8_t duplication_e_mask; // = 0
864
+  #endif
866 865
 #endif
867 866
 
868 867
 #if ENABLED(DUAL_X_CARRIAGE)

+ 3
- 4
Marlin/src/module/motion.h View File

@@ -318,10 +318,9 @@ void homeaxis(const AxisEnum axis);
318 318
 #if HAS_DUPLICATION_MODE
319 319
   extern bool extruder_duplication_enabled,       // Used in Dual X mode 2
320 320
               mirrored_duplication_mode;          // Used in Dual X mode 3
321
-#endif
322
-
323
-#if ENABLED(MULTI_NOZZLE_DUPLICATION) && HOTENDS > 2
324
-  uint8_t duplication_e_mask;
321
+  #if ENABLED(MULTI_NOZZLE_DUPLICATION)
322
+    extern uint8_t duplication_e_mask;
323
+  #endif
325 324
 #endif
326 325
 
327 326
 /**

+ 11
- 6
Marlin/src/module/stepper_indirection.h View File

@@ -618,14 +618,20 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
618 618
     #define    _REV_E_DIR(E)   do{ if (E == 0) { E0_DIR_WRITE( INVERT_E0_DIR); } else { E1_DIR_WRITE( INVERT_E1_DIR); } }while(0)
619 619
   #endif
620 620
 
621
-  #if EITHER(DUAL_X_CARRIAGE, MULTI_NOZZLE_DUPLICATION)
621
+  #if HAS_DUPLICATION_MODE
622
+
623
+    #if ENABLED(MULTI_NOZZLE_DUPLICATION)
624
+      #define _DUPE(N,T,V)  do{ if (TEST(duplication_e_mask, N)) E##N##_##T##_WRITE(V); }while(0)
625
+    #else
626
+      #define _DUPE(N,T,V)  E##N##_##T##_WRITE(V)
627
+    #endif
628
+
629
+    #define NDIR(N) _DUPE(N,DIR,!INVERT_E##N##_DIR)
630
+    #define RDIR(N) _DUPE(N,DIR, INVERT_E##N##_DIR)
622 631
 
623
-    #define NDIR(N) _DUPE(DIR,!INVERT_E##N##_DIR)
624
-    #define RDIR(N) _DUPE(DIR, INVERT_E##N##_DIR)
625 632
     #define E_STEP_WRITE(E,V) do{ if (extruder_duplication_enabled) { DUPE(STEP,V); } else _E_STEP_WRITE(E,V); }while(0)
626 633
 
627 634
     #if E_STEPPERS > 2
628
-      #define _DUPE(N,T,V)    do{ if (duplication_e_mask <= (N)) E##N##_##T##_WRITE(V); }while(0)
629 635
       #if E_STEPPERS > 5
630 636
         #define DUPE(T,V)     do{ _DUPE(0,T,V); _DUPE(1,T,V); _DUPE(2,T,V); _DUPE(3,T,V); _DUPE(4,T,V); _DUPE(5,T,V); }while(0)
631 637
         #define NORM_E_DIR(E) do{ if (extruder_duplication_enabled) { NDIR(0); NDIR(1); NDIR(2); NDIR(3); NDIR(4); NDIR(5); } else _NORM_E_DIR(E); }while(0)
@@ -644,8 +650,7 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
644 650
         #define REV_E_DIR(E)  do{ if (extruder_duplication_enabled) { RDIR(0); RDIR(1); RDIR(2); } else  _REV_E_DIR(E); }while(0)
645 651
       #endif
646 652
     #else
647
-      #define _DUPE(T,V)    do{ E0_##T##_WRITE(V); E1_##T##_WRITE(V); }while(0)
648
-      #define DUPE(T,V)  _DUPE(T,V)
653
+      #define DUPE(T,V)     do{ _DUPE(0,T,V); _DUPE(1,T,V); } while(0)
649 654
       #define NORM_E_DIR(E) do{ if (extruder_duplication_enabled) { NDIR(0); NDIR(1); } else _NORM_E_DIR(E); }while(0)
650 655
       #define REV_E_DIR(E)  do{ if (extruder_duplication_enabled) { RDIR(0); RDIR(1); } else  _REV_E_DIR(E); }while(0)
651 656
     #endif

Loading…
Cancel
Save