瀏覽代碼

Move stepper enable/disable to stepper_indirection.h (#12562)

Scott Lahteine 5 年之前
父節點
當前提交
3c58b16c9f
沒有連結到貢獻者的電子郵件帳戶。
共有 4 個檔案被更改,包括 131 行新增122 行删除
  1. 0
    120
      Marlin/src/Marlin.h
  2. 7
    1
      Marlin/src/module/probe.cpp
  3. 123
    0
      Marlin/src/module/stepper_indirection.h
  4. 1
    1
      Marlin/src/pins/pins_ANET_10.h

+ 0
- 120
Marlin/src/Marlin.h 查看文件

@@ -41,126 +41,6 @@ void idle(
41 41
 
42 42
 void manage_inactivity(const bool ignore_stepper_queue=false);
43 43
 
44
-#if HAS_X2_ENABLE
45
-  #define  enable_X() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0)
46
-  #define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0)
47
-#elif HAS_X_ENABLE
48
-  #define  enable_X() X_ENABLE_WRITE( X_ENABLE_ON)
49
-  #define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0)
50
-#else
51
-  #define  enable_X() NOOP
52
-  #define disable_X() NOOP
53
-#endif
54
-
55
-#if HAS_Y2_ENABLE
56
-  #define  enable_Y() do{ Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }while(0)
57
-  #define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0)
58
-#elif HAS_Y_ENABLE
59
-  #define  enable_Y() Y_ENABLE_WRITE( Y_ENABLE_ON)
60
-  #define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0)
61
-#else
62
-  #define  enable_Y() NOOP
63
-  #define disable_Y() NOOP
64
-#endif
65
-
66
-#if HAS_Z3_ENABLE
67
-  #define  enable_Z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); Z3_ENABLE_WRITE(Z_ENABLE_ON); }while(0)
68
-  #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); Z3_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
69
-#elif HAS_Z2_ENABLE
70
-  #define  enable_Z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }while(0)
71
-  #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
72
-#elif HAS_Z_ENABLE
73
-  #define  enable_Z() Z_ENABLE_WRITE( Z_ENABLE_ON)
74
-  #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
75
-#else
76
-  #define  enable_Z() NOOP
77
-  #define disable_Z() NOOP
78
-#endif
79
-
80
-#if ENABLED(MIXING_EXTRUDER)
81
-
82
-  /**
83
-   * Mixing steppers synchronize their enable (and direction) together
84
-   */
85
-  #if MIXING_STEPPERS > 5
86
-    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); E4_ENABLE_WRITE( E_ENABLE_ON); E5_ENABLE_WRITE( E_ENABLE_ON); }
87
-    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); E4_ENABLE_WRITE(!E_ENABLE_ON); E5_ENABLE_WRITE(!E_ENABLE_ON); }
88
-  #elif MIXING_STEPPERS > 4
89
-    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); E4_ENABLE_WRITE( E_ENABLE_ON); }
90
-    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); E4_ENABLE_WRITE(!E_ENABLE_ON); }
91
-  #elif MIXING_STEPPERS > 3
92
-    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); }
93
-    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); }
94
-  #elif MIXING_STEPPERS > 2
95
-    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); }
96
-    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); }
97
-  #else
98
-    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); }
99
-    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); }
100
-  #endif
101
-  #define  enable_E1() NOOP
102
-  #define disable_E1() NOOP
103
-  #define  enable_E2() NOOP
104
-  #define disable_E2() NOOP
105
-  #define  enable_E3() NOOP
106
-  #define disable_E3() NOOP
107
-  #define  enable_E4() NOOP
108
-  #define disable_E4() NOOP
109
-  #define  enable_E5() NOOP
110
-  #define disable_E5() NOOP
111
-
112
-#else // !MIXING_EXTRUDER
113
-
114
-  #if HAS_E0_ENABLE
115
-    #define  enable_E0() E0_ENABLE_WRITE( E_ENABLE_ON)
116
-    #define disable_E0() E0_ENABLE_WRITE(!E_ENABLE_ON)
117
-  #else
118
-    #define  enable_E0() NOOP
119
-    #define disable_E0() NOOP
120
-  #endif
121
-
122
-  #if E_STEPPERS > 1 && HAS_E1_ENABLE
123
-    #define  enable_E1() E1_ENABLE_WRITE( E_ENABLE_ON)
124
-    #define disable_E1() E1_ENABLE_WRITE(!E_ENABLE_ON)
125
-  #else
126
-    #define  enable_E1() NOOP
127
-    #define disable_E1() NOOP
128
-  #endif
129
-
130
-  #if E_STEPPERS > 2 && HAS_E2_ENABLE
131
-    #define  enable_E2() E2_ENABLE_WRITE( E_ENABLE_ON)
132
-    #define disable_E2() E2_ENABLE_WRITE(!E_ENABLE_ON)
133
-  #else
134
-    #define  enable_E2() NOOP
135
-    #define disable_E2() NOOP
136
-  #endif
137
-
138
-  #if E_STEPPERS > 3 && HAS_E3_ENABLE
139
-    #define  enable_E3() E3_ENABLE_WRITE( E_ENABLE_ON)
140
-    #define disable_E3() E3_ENABLE_WRITE(!E_ENABLE_ON)
141
-  #else
142
-    #define  enable_E3() NOOP
143
-    #define disable_E3() NOOP
144
-  #endif
145
-
146
-  #if E_STEPPERS > 4 && HAS_E4_ENABLE
147
-    #define  enable_E4() E4_ENABLE_WRITE( E_ENABLE_ON)
148
-    #define disable_E4() E4_ENABLE_WRITE(!E_ENABLE_ON)
149
-  #else
150
-    #define  enable_E4() NOOP
151
-    #define disable_E4() NOOP
152
-  #endif
153
-
154
-  #if E_STEPPERS > 5 && HAS_E5_ENABLE
155
-    #define  enable_E5() E5_ENABLE_WRITE( E_ENABLE_ON)
156
-    #define disable_E5() E5_ENABLE_WRITE(!E_ENABLE_ON)
157
-  #else
158
-    #define  enable_E5() NOOP
159
-    #define disable_E5() NOOP
160
-  #endif
161
-
162
-#endif // !MIXING_EXTRUDER
163
-
164 44
 #if ENABLED(EXPERIMENTAL_I2CBUS)
165 45
   #include "feature/twibus.h"
166 46
   extern TWIBus i2c;

+ 7
- 1
Marlin/src/module/probe.cpp 查看文件

@@ -38,7 +38,9 @@
38 38
 #include "../gcode/gcode.h"
39 39
 #include "../lcd/ultralcd.h"
40 40
 
41
-#include "../Marlin.h"
41
+#if ENABLED(BLTOUCH) || ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(PROBE_TRIGGERED_WHEN_STOWED_TEST)
42
+  #include "../Marlin.h" // for stop()
43
+#endif
42 44
 
43 45
 #if HAS_LEVELING
44 46
   #include "../feature/bedlevel/bedlevel.h"
@@ -63,6 +65,10 @@ float zprobe_zoffset; // Initialized by settings.load()
63 65
   #include "../feature/tmc_util.h"
64 66
 #endif
65 67
 
68
+#if QUIET_PROBING
69
+  #include "stepper_indirection.h"
70
+#endif
71
+
66 72
 #if ENABLED(Z_PROBE_SLED)
67 73
 
68 74
   #ifndef SLED_DOCKING_OFFSET

+ 123
- 0
Marlin/src/module/stepper_indirection.h 查看文件

@@ -613,3 +613,126 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
613 613
   #define   NORM_E_DIR(E)   E0_DIR_WRITE(!INVERT_E0_DIR)
614 614
   #define    REV_E_DIR(E)   E0_DIR_WRITE( INVERT_E0_DIR)
615 615
 #endif
616
+
617
+//
618
+// Stepper enable / disable
619
+//
620
+#if HAS_X2_ENABLE
621
+  #define  enable_X() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0)
622
+  #define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0)
623
+#elif HAS_X_ENABLE
624
+  #define  enable_X() X_ENABLE_WRITE( X_ENABLE_ON)
625
+  #define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0)
626
+#else
627
+  #define  enable_X() NOOP
628
+  #define disable_X() NOOP
629
+#endif
630
+
631
+#if HAS_Y2_ENABLE
632
+  #define  enable_Y() do{ Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }while(0)
633
+  #define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0)
634
+#elif HAS_Y_ENABLE
635
+  #define  enable_Y() Y_ENABLE_WRITE( Y_ENABLE_ON)
636
+  #define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0)
637
+#else
638
+  #define  enable_Y() NOOP
639
+  #define disable_Y() NOOP
640
+#endif
641
+
642
+#if HAS_Z3_ENABLE
643
+  #define  enable_Z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); Z3_ENABLE_WRITE(Z_ENABLE_ON); }while(0)
644
+  #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); Z3_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
645
+#elif HAS_Z2_ENABLE
646
+  #define  enable_Z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }while(0)
647
+  #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
648
+#elif HAS_Z_ENABLE
649
+  #define  enable_Z() Z_ENABLE_WRITE( Z_ENABLE_ON)
650
+  #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
651
+#else
652
+  #define  enable_Z() NOOP
653
+  #define disable_Z() NOOP
654
+#endif
655
+
656
+#if ENABLED(MIXING_EXTRUDER)
657
+
658
+  /**
659
+   * Mixing steppers synchronize their enable (and direction) together
660
+   */
661
+  #if MIXING_STEPPERS > 5
662
+    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); E4_ENABLE_WRITE( E_ENABLE_ON); E5_ENABLE_WRITE( E_ENABLE_ON); }
663
+    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); E4_ENABLE_WRITE(!E_ENABLE_ON); E5_ENABLE_WRITE(!E_ENABLE_ON); }
664
+  #elif MIXING_STEPPERS > 4
665
+    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); E4_ENABLE_WRITE( E_ENABLE_ON); }
666
+    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); E4_ENABLE_WRITE(!E_ENABLE_ON); }
667
+  #elif MIXING_STEPPERS > 3
668
+    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); }
669
+    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); }
670
+  #elif MIXING_STEPPERS > 2
671
+    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); }
672
+    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); }
673
+  #else
674
+    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); }
675
+    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); }
676
+  #endif
677
+  #define  enable_E1() NOOP
678
+  #define disable_E1() NOOP
679
+  #define  enable_E2() NOOP
680
+  #define disable_E2() NOOP
681
+  #define  enable_E3() NOOP
682
+  #define disable_E3() NOOP
683
+  #define  enable_E4() NOOP
684
+  #define disable_E4() NOOP
685
+  #define  enable_E5() NOOP
686
+  #define disable_E5() NOOP
687
+
688
+#else // !MIXING_EXTRUDER
689
+
690
+  #if HAS_E0_ENABLE
691
+    #define  enable_E0() E0_ENABLE_WRITE( E_ENABLE_ON)
692
+    #define disable_E0() E0_ENABLE_WRITE(!E_ENABLE_ON)
693
+  #else
694
+    #define  enable_E0() NOOP
695
+    #define disable_E0() NOOP
696
+  #endif
697
+
698
+  #if E_STEPPERS > 1 && HAS_E1_ENABLE
699
+    #define  enable_E1() E1_ENABLE_WRITE( E_ENABLE_ON)
700
+    #define disable_E1() E1_ENABLE_WRITE(!E_ENABLE_ON)
701
+  #else
702
+    #define  enable_E1() NOOP
703
+    #define disable_E1() NOOP
704
+  #endif
705
+
706
+  #if E_STEPPERS > 2 && HAS_E2_ENABLE
707
+    #define  enable_E2() E2_ENABLE_WRITE( E_ENABLE_ON)
708
+    #define disable_E2() E2_ENABLE_WRITE(!E_ENABLE_ON)
709
+  #else
710
+    #define  enable_E2() NOOP
711
+    #define disable_E2() NOOP
712
+  #endif
713
+
714
+  #if E_STEPPERS > 3 && HAS_E3_ENABLE
715
+    #define  enable_E3() E3_ENABLE_WRITE( E_ENABLE_ON)
716
+    #define disable_E3() E3_ENABLE_WRITE(!E_ENABLE_ON)
717
+  #else
718
+    #define  enable_E3() NOOP
719
+    #define disable_E3() NOOP
720
+  #endif
721
+
722
+  #if E_STEPPERS > 4 && HAS_E4_ENABLE
723
+    #define  enable_E4() E4_ENABLE_WRITE( E_ENABLE_ON)
724
+    #define disable_E4() E4_ENABLE_WRITE(!E_ENABLE_ON)
725
+  #else
726
+    #define  enable_E4() NOOP
727
+    #define disable_E4() NOOP
728
+  #endif
729
+
730
+  #if E_STEPPERS > 5 && HAS_E5_ENABLE
731
+    #define  enable_E5() E5_ENABLE_WRITE( E_ENABLE_ON)
732
+    #define disable_E5() E5_ENABLE_WRITE(!E_ENABLE_ON)
733
+  #else
734
+    #define  enable_E5() NOOP
735
+    #define disable_E5() NOOP
736
+  #endif
737
+
738
+#endif // !MIXING_EXTRUDER

+ 1
- 1
Marlin/src/pins/pins_ANET_10.h 查看文件

@@ -89,7 +89,7 @@
89 89
  */
90 90
 
91 91
 #ifndef __AVR_ATmega1284P__
92
-  #error "Oops! Select 'Anet V1.0', 'Anet V1.0 (Optiboot)' or 'Sanguino' in 'Tools > Board' and 'ATmega1284P' in 'Tools > Processor.'"
92
+  #error "Oops! Select 'Sanguino' in 'Tools > Board' and 'ATmega1284P' in 'Tools > Processor.' (For PlatformIO, use 'melzi' or 'melzi_optiboot.')"
93 93
 #endif
94 94
 
95 95
 #define BOARD_NAME "Anet 1.0"

Loading…
取消
儲存