Просмотр исходного кода

Simplify stepper macros by renaming enable/disable macros

Scott Lahteine 8 лет назад
Родитель
Сommit
68773f4486
4 измененных файлов: 139 добавлений и 138 удалений
  1. 52
    52
      Marlin/Marlin.h
  2. 28
    28
      Marlin/Marlin_main.cpp
  3. 46
    46
      Marlin/planner.cpp
  4. 13
    12
      Marlin/stepper.cpp

+ 52
- 52
Marlin/Marlin.h Просмотреть файл

60
 #endif
60
 #endif
61
 
61
 
62
 #if HAS_X2_ENABLE
62
 #if HAS_X2_ENABLE
63
-  #define  enable_x() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0)
64
-  #define disable_x() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }while(0)
63
+  #define  enable_X() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0)
64
+  #define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }while(0)
65
 #elif HAS_X_ENABLE
65
 #elif HAS_X_ENABLE
66
-  #define  enable_x() X_ENABLE_WRITE( X_ENABLE_ON)
67
-  #define disable_x() do{ X_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }while(0)
66
+  #define  enable_X() X_ENABLE_WRITE( X_ENABLE_ON)
67
+  #define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }while(0)
68
 #else
68
 #else
69
-  #define  enable_x() NOOP
70
-  #define disable_x() NOOP
69
+  #define  enable_X() NOOP
70
+  #define disable_X() NOOP
71
 #endif
71
 #endif
72
 
72
 
73
 #if HAS_Y2_ENABLE
73
 #if HAS_Y2_ENABLE
74
-  #define  enable_y() do{ Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }while(0)
75
-  #define disable_y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }while(0)
74
+  #define  enable_Y() do{ Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }while(0)
75
+  #define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }while(0)
76
 #elif HAS_Y_ENABLE
76
 #elif HAS_Y_ENABLE
77
-  #define  enable_y() Y_ENABLE_WRITE( Y_ENABLE_ON)
78
-  #define disable_y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }while(0)
77
+  #define  enable_Y() Y_ENABLE_WRITE( Y_ENABLE_ON)
78
+  #define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }while(0)
79
 #else
79
 #else
80
-  #define  enable_y() NOOP
81
-  #define disable_y() NOOP
80
+  #define  enable_Y() NOOP
81
+  #define disable_Y() NOOP
82
 #endif
82
 #endif
83
 
83
 
84
 #if HAS_Z2_ENABLE
84
 #if HAS_Z2_ENABLE
85
-  #define  enable_z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }while(0)
86
-  #define disable_z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }while(0)
85
+  #define  enable_Z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }while(0)
86
+  #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }while(0)
87
 #elif HAS_Z_ENABLE
87
 #elif HAS_Z_ENABLE
88
-  #define  enable_z() Z_ENABLE_WRITE( Z_ENABLE_ON)
89
-  #define disable_z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }while(0)
88
+  #define  enable_Z() Z_ENABLE_WRITE( Z_ENABLE_ON)
89
+  #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }while(0)
90
 #else
90
 #else
91
-  #define  enable_z() NOOP
92
-  #define disable_z() NOOP
91
+  #define  enable_Z() NOOP
92
+  #define disable_Z() NOOP
93
 #endif
93
 #endif
94
 
94
 
95
 #if ENABLED(MIXING_EXTRUDER)
95
 #if ENABLED(MIXING_EXTRUDER)
98
    * Mixing steppers synchronize their enable (and direction) together
98
    * Mixing steppers synchronize their enable (and direction) together
99
    */
99
    */
100
   #if MIXING_STEPPERS > 3
100
   #if MIXING_STEPPERS > 3
101
-    #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); }
102
-    #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); }
101
+    #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); }
102
+    #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); }
103
   #elif MIXING_STEPPERS > 2
103
   #elif MIXING_STEPPERS > 2
104
-    #define  enable_e0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); }
105
-    #define disable_e0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); }
104
+    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); }
105
+    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); }
106
   #else
106
   #else
107
-    #define  enable_e0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); }
108
-    #define disable_e0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); }
107
+    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); }
108
+    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); }
109
   #endif
109
   #endif
110
-  #define  enable_e1() NOOP
111
-  #define disable_e1() NOOP
112
-  #define  enable_e2() NOOP
113
-  #define disable_e2() NOOP
114
-  #define  enable_e3() NOOP
115
-  #define disable_e3() NOOP
116
-  #define  enable_e4() NOOP
117
-  #define disable_e4() NOOP
110
+  #define  enable_E1() NOOP
111
+  #define disable_E1() NOOP
112
+  #define  enable_E2() NOOP
113
+  #define disable_E2() NOOP
114
+  #define  enable_E3() NOOP
115
+  #define disable_E3() NOOP
116
+  #define  enable_E4() NOOP
117
+  #define disable_E4() NOOP
118
 
118
 
119
 #else // !MIXING_EXTRUDER
119
 #else // !MIXING_EXTRUDER
120
 
120
 
121
   #if HAS_E0_ENABLE
121
   #if HAS_E0_ENABLE
122
-    #define  enable_e0() E0_ENABLE_WRITE( E_ENABLE_ON)
123
-    #define disable_e0() E0_ENABLE_WRITE(!E_ENABLE_ON)
122
+    #define  enable_E0() E0_ENABLE_WRITE( E_ENABLE_ON)
123
+    #define disable_E0() E0_ENABLE_WRITE(!E_ENABLE_ON)
124
   #else
124
   #else
125
-    #define  enable_e0() NOOP
126
-    #define disable_e0() NOOP
125
+    #define  enable_E0() NOOP
126
+    #define disable_E0() NOOP
127
   #endif
127
   #endif
128
 
128
 
129
   #if E_STEPPERS > 1 && HAS_E1_ENABLE
129
   #if E_STEPPERS > 1 && HAS_E1_ENABLE
130
-    #define  enable_e1() E1_ENABLE_WRITE( E_ENABLE_ON)
131
-    #define disable_e1() E1_ENABLE_WRITE(!E_ENABLE_ON)
130
+    #define  enable_E1() E1_ENABLE_WRITE( E_ENABLE_ON)
131
+    #define disable_E1() E1_ENABLE_WRITE(!E_ENABLE_ON)
132
   #else
132
   #else
133
-    #define  enable_e1() NOOP
134
-    #define disable_e1() NOOP
133
+    #define  enable_E1() NOOP
134
+    #define disable_E1() NOOP
135
   #endif
135
   #endif
136
 
136
 
137
   #if E_STEPPERS > 2 && HAS_E2_ENABLE
137
   #if E_STEPPERS > 2 && HAS_E2_ENABLE
138
-    #define  enable_e2() E2_ENABLE_WRITE( E_ENABLE_ON)
139
-    #define disable_e2() E2_ENABLE_WRITE(!E_ENABLE_ON)
138
+    #define  enable_E2() E2_ENABLE_WRITE( E_ENABLE_ON)
139
+    #define disable_E2() E2_ENABLE_WRITE(!E_ENABLE_ON)
140
   #else
140
   #else
141
-    #define  enable_e2() NOOP
142
-    #define disable_e2() NOOP
141
+    #define  enable_E2() NOOP
142
+    #define disable_E2() NOOP
143
   #endif
143
   #endif
144
 
144
 
145
   #if E_STEPPERS > 3 && HAS_E3_ENABLE
145
   #if E_STEPPERS > 3 && HAS_E3_ENABLE
146
-    #define  enable_e3() E3_ENABLE_WRITE( E_ENABLE_ON)
147
-    #define disable_e3() E3_ENABLE_WRITE(!E_ENABLE_ON)
146
+    #define  enable_E3() E3_ENABLE_WRITE( E_ENABLE_ON)
147
+    #define disable_E3() E3_ENABLE_WRITE(!E_ENABLE_ON)
148
   #else
148
   #else
149
-    #define  enable_e3() NOOP
150
-    #define disable_e3() NOOP
149
+    #define  enable_E3() NOOP
150
+    #define disable_E3() NOOP
151
   #endif
151
   #endif
152
 
152
 
153
   #if E_STEPPERS > 4 && HAS_E4_ENABLE
153
   #if E_STEPPERS > 4 && HAS_E4_ENABLE
154
-    #define  enable_e4() E4_ENABLE_WRITE( E_ENABLE_ON)
155
-    #define disable_e4() E4_ENABLE_WRITE(!E_ENABLE_ON)
154
+    #define  enable_E4() E4_ENABLE_WRITE( E_ENABLE_ON)
155
+    #define disable_E4() E4_ENABLE_WRITE(!E_ENABLE_ON)
156
   #else
156
   #else
157
-    #define  enable_e4() NOOP
158
-    #define disable_e4() NOOP
157
+    #define  enable_E4() NOOP
158
+    #define disable_E4() NOOP
159
   #endif
159
   #endif
160
 
160
 
161
 #endif // !MIXING_EXTRUDER
161
 #endif // !MIXING_EXTRUDER

+ 28
- 28
Marlin/Marlin_main.cpp Просмотреть файл

6489
     }
6489
     }
6490
     else {
6490
     else {
6491
       stepper.synchronize();
6491
       stepper.synchronize();
6492
-      if (code_seen('X')) disable_x();
6493
-      if (code_seen('Y')) disable_y();
6494
-      if (code_seen('Z')) disable_z();
6492
+      if (code_seen('X')) disable_X();
6493
+      if (code_seen('Y')) disable_Y();
6494
+      if (code_seen('Z')) disable_Z();
6495
       #if ((E0_ENABLE_PIN != X_ENABLE_PIN) && (E1_ENABLE_PIN != Y_ENABLE_PIN)) // Only enable on boards that have seperate ENABLE_PINS
6495
       #if ((E0_ENABLE_PIN != X_ENABLE_PIN) && (E1_ENABLE_PIN != Y_ENABLE_PIN)) // Only enable on boards that have seperate ENABLE_PINS
6496
         if (code_seen('E')) disable_e_steppers();
6496
         if (code_seen('E')) disable_e_steppers();
6497
       #endif
6497
       #endif
10888
 }
10888
 }
10889
 
10889
 
10890
 void enable_all_steppers() {
10890
 void enable_all_steppers() {
10891
-  enable_x();
10892
-  enable_y();
10893
-  enable_z();
10894
-  enable_e0();
10895
-  enable_e1();
10896
-  enable_e2();
10897
-  enable_e3();
10898
-  enable_e4();
10891
+  enable_X();
10892
+  enable_Y();
10893
+  enable_Z();
10894
+  enable_E0();
10895
+  enable_E1();
10896
+  enable_E2();
10897
+  enable_E3();
10898
+  enable_E4();
10899
 }
10899
 }
10900
 
10900
 
10901
 void disable_e_steppers() {
10901
 void disable_e_steppers() {
10902
-  disable_e0();
10903
-  disable_e1();
10904
-  disable_e2();
10905
-  disable_e3();
10906
-  disable_e4();
10902
+  disable_E0();
10903
+  disable_E1();
10904
+  disable_E2();
10905
+  disable_E3();
10906
+  disable_E4();
10907
 }
10907
 }
10908
 
10908
 
10909
 void disable_all_steppers() {
10909
 void disable_all_steppers() {
10910
-  disable_x();
10911
-  disable_y();
10912
-  disable_z();
10910
+  disable_X();
10911
+  disable_Y();
10912
+  disable_Z();
10913
   disable_e_steppers();
10913
   disable_e_steppers();
10914
 }
10914
 }
10915
 
10915
 
11011
   if (M600_TEST && stepper_inactive_time && ELAPSED(ms, previous_cmd_ms + stepper_inactive_time)
11011
   if (M600_TEST && stepper_inactive_time && ELAPSED(ms, previous_cmd_ms + stepper_inactive_time)
11012
       && !ignore_stepper_queue && !planner.blocks_queued()) {
11012
       && !ignore_stepper_queue && !planner.blocks_queued()) {
11013
     #if ENABLED(DISABLE_INACTIVE_X)
11013
     #if ENABLED(DISABLE_INACTIVE_X)
11014
-      disable_x();
11014
+      disable_X();
11015
     #endif
11015
     #endif
11016
     #if ENABLED(DISABLE_INACTIVE_Y)
11016
     #if ENABLED(DISABLE_INACTIVE_Y)
11017
-      disable_y();
11017
+      disable_Y();
11018
     #endif
11018
     #endif
11019
     #if ENABLED(DISABLE_INACTIVE_Z)
11019
     #if ENABLED(DISABLE_INACTIVE_Z)
11020
-      disable_z();
11020
+      disable_Z();
11021
     #endif
11021
     #endif
11022
     #if ENABLED(DISABLE_INACTIVE_E)
11022
     #if ENABLED(DISABLE_INACTIVE_E)
11023
       disable_e_steppers();
11023
       disable_e_steppers();
11080
       bool oldstatus;
11080
       bool oldstatus;
11081
       #if ENABLED(SWITCHING_EXTRUDER)
11081
       #if ENABLED(SWITCHING_EXTRUDER)
11082
         oldstatus = E0_ENABLE_READ;
11082
         oldstatus = E0_ENABLE_READ;
11083
-        enable_e0();
11083
+        enable_E0();
11084
       #else // !SWITCHING_EXTRUDER
11084
       #else // !SWITCHING_EXTRUDER
11085
         switch (active_extruder) {
11085
         switch (active_extruder) {
11086
           case 0:
11086
           case 0:
11087
             oldstatus = E0_ENABLE_READ;
11087
             oldstatus = E0_ENABLE_READ;
11088
-            enable_e0();
11088
+            enable_E0();
11089
             break;
11089
             break;
11090
           #if E_STEPPERS > 1
11090
           #if E_STEPPERS > 1
11091
             case 1:
11091
             case 1:
11092
               oldstatus = E1_ENABLE_READ;
11092
               oldstatus = E1_ENABLE_READ;
11093
-              enable_e1();
11093
+              enable_E1();
11094
               break;
11094
               break;
11095
             #if E_STEPPERS > 2
11095
             #if E_STEPPERS > 2
11096
               case 2:
11096
               case 2:
11097
                 oldstatus = E2_ENABLE_READ;
11097
                 oldstatus = E2_ENABLE_READ;
11098
-                enable_e2();
11098
+                enable_E2();
11099
                 break;
11099
                 break;
11100
               #if E_STEPPERS > 3
11100
               #if E_STEPPERS > 3
11101
                 case 3:
11101
                 case 3:
11102
                   oldstatus = E3_ENABLE_READ;
11102
                   oldstatus = E3_ENABLE_READ;
11103
-                  enable_e3();
11103
+                  enable_E3();
11104
                   break;
11104
                   break;
11105
                 #if E_STEPPERS > 4
11105
                 #if E_STEPPERS > 4
11106
                   case 4:
11106
                   case 4:
11107
                     oldstatus = E4_ENABLE_READ;
11107
                     oldstatus = E4_ENABLE_READ;
11108
-                    enable_e4();
11108
+                    enable_E4();
11109
                     break;
11109
                     break;
11110
                 #endif // E_STEPPERS > 4
11110
                 #endif // E_STEPPERS > 4
11111
               #endif // E_STEPPERS > 3
11111
               #endif // E_STEPPERS > 3

+ 46
- 46
Marlin/planner.cpp Просмотреть файл

441
     }
441
     }
442
   }
442
   }
443
   #if ENABLED(DISABLE_X)
443
   #if ENABLED(DISABLE_X)
444
-    if (!axis_active[X_AXIS]) disable_x();
444
+    if (!axis_active[X_AXIS]) disable_X();
445
   #endif
445
   #endif
446
   #if ENABLED(DISABLE_Y)
446
   #if ENABLED(DISABLE_Y)
447
-    if (!axis_active[Y_AXIS]) disable_y();
447
+    if (!axis_active[Y_AXIS]) disable_Y();
448
   #endif
448
   #endif
449
   #if ENABLED(DISABLE_Z)
449
   #if ENABLED(DISABLE_Z)
450
-    if (!axis_active[Z_AXIS]) disable_z();
450
+    if (!axis_active[Z_AXIS]) disable_Z();
451
   #endif
451
   #endif
452
   #if ENABLED(DISABLE_E)
452
   #if ENABLED(DISABLE_E)
453
     if (!axis_active[E_AXIS]) disable_e_steppers();
453
     if (!axis_active[E_AXIS]) disable_e_steppers();
832
   //enable active axes
832
   //enable active axes
833
   #if CORE_IS_XY
833
   #if CORE_IS_XY
834
     if (block->steps[A_AXIS] || block->steps[B_AXIS]) {
834
     if (block->steps[A_AXIS] || block->steps[B_AXIS]) {
835
-      enable_x();
836
-      enable_y();
835
+      enable_X();
836
+      enable_Y();
837
     }
837
     }
838
     #if DISABLED(Z_LATE_ENABLE)
838
     #if DISABLED(Z_LATE_ENABLE)
839
-      if (block->steps[Z_AXIS]) enable_z();
839
+      if (block->steps[Z_AXIS]) enable_Z();
840
     #endif
840
     #endif
841
   #elif CORE_IS_XZ
841
   #elif CORE_IS_XZ
842
     if (block->steps[A_AXIS] || block->steps[C_AXIS]) {
842
     if (block->steps[A_AXIS] || block->steps[C_AXIS]) {
843
-      enable_x();
844
-      enable_z();
843
+      enable_X();
844
+      enable_Z();
845
     }
845
     }
846
-    if (block->steps[Y_AXIS]) enable_y();
846
+    if (block->steps[Y_AXIS]) enable_Y();
847
   #elif CORE_IS_YZ
847
   #elif CORE_IS_YZ
848
     if (block->steps[B_AXIS] || block->steps[C_AXIS]) {
848
     if (block->steps[B_AXIS] || block->steps[C_AXIS]) {
849
-      enable_y();
850
-      enable_z();
849
+      enable_Y();
850
+      enable_Z();
851
     }
851
     }
852
-    if (block->steps[X_AXIS]) enable_x();
852
+    if (block->steps[X_AXIS]) enable_X();
853
   #else
853
   #else
854
-    if (block->steps[X_AXIS]) enable_x();
855
-    if (block->steps[Y_AXIS]) enable_y();
854
+    if (block->steps[X_AXIS]) enable_X();
855
+    if (block->steps[Y_AXIS]) enable_Y();
856
     #if DISABLED(Z_LATE_ENABLE)
856
     #if DISABLED(Z_LATE_ENABLE)
857
-      if (block->steps[Z_AXIS]) enable_z();
857
+      if (block->steps[Z_AXIS]) enable_Z();
858
     #endif
858
     #endif
859
   #endif
859
   #endif
860
 
860
 
868
 
868
 
869
       switch(extruder) {
869
       switch(extruder) {
870
         case 0:
870
         case 0:
871
-          enable_e0();
871
+          enable_E0();
872
           #if ENABLED(DUAL_X_CARRIAGE)
872
           #if ENABLED(DUAL_X_CARRIAGE)
873
             if (extruder_duplication_enabled) {
873
             if (extruder_duplication_enabled) {
874
-              enable_e1();
874
+              enable_E1();
875
               g_uc_extruder_last_move[1] = (BLOCK_BUFFER_SIZE) * 2;
875
               g_uc_extruder_last_move[1] = (BLOCK_BUFFER_SIZE) * 2;
876
             }
876
             }
877
           #endif
877
           #endif
878
           g_uc_extruder_last_move[0] = (BLOCK_BUFFER_SIZE) * 2;
878
           g_uc_extruder_last_move[0] = (BLOCK_BUFFER_SIZE) * 2;
879
           #if EXTRUDERS > 1
879
           #if EXTRUDERS > 1
880
-            if (g_uc_extruder_last_move[1] == 0) disable_e1();
880
+            if (g_uc_extruder_last_move[1] == 0) disable_E1();
881
             #if EXTRUDERS > 2
881
             #if EXTRUDERS > 2
882
-              if (g_uc_extruder_last_move[2] == 0) disable_e2();
882
+              if (g_uc_extruder_last_move[2] == 0) disable_E2();
883
               #if EXTRUDERS > 3
883
               #if EXTRUDERS > 3
884
-                if (g_uc_extruder_last_move[3] == 0) disable_e3();
884
+                if (g_uc_extruder_last_move[3] == 0) disable_E3();
885
                 #if EXTRUDERS > 4
885
                 #if EXTRUDERS > 4
886
-                  if (g_uc_extruder_last_move[4] == 0) disable_e4();
886
+                  if (g_uc_extruder_last_move[4] == 0) disable_E4();
887
                 #endif // EXTRUDERS > 4
887
                 #endif // EXTRUDERS > 4
888
               #endif // EXTRUDERS > 3
888
               #endif // EXTRUDERS > 3
889
             #endif // EXTRUDERS > 2
889
             #endif // EXTRUDERS > 2
891
         break;
891
         break;
892
         #if EXTRUDERS > 1
892
         #if EXTRUDERS > 1
893
           case 1:
893
           case 1:
894
-            enable_e1();
894
+            enable_E1();
895
             g_uc_extruder_last_move[1] = (BLOCK_BUFFER_SIZE) * 2;
895
             g_uc_extruder_last_move[1] = (BLOCK_BUFFER_SIZE) * 2;
896
-            if (g_uc_extruder_last_move[0] == 0) disable_e0();
896
+            if (g_uc_extruder_last_move[0] == 0) disable_E0();
897
             #if EXTRUDERS > 2
897
             #if EXTRUDERS > 2
898
-              if (g_uc_extruder_last_move[2] == 0) disable_e2();
898
+              if (g_uc_extruder_last_move[2] == 0) disable_E2();
899
               #if EXTRUDERS > 3
899
               #if EXTRUDERS > 3
900
-                if (g_uc_extruder_last_move[3] == 0) disable_e3();
900
+                if (g_uc_extruder_last_move[3] == 0) disable_E3();
901
                 #if EXTRUDERS > 4
901
                 #if EXTRUDERS > 4
902
-                  if (g_uc_extruder_last_move[4] == 0) disable_e4();
902
+                  if (g_uc_extruder_last_move[4] == 0) disable_E4();
903
                 #endif // EXTRUDERS > 4
903
                 #endif // EXTRUDERS > 4
904
               #endif // EXTRUDERS > 3
904
               #endif // EXTRUDERS > 3
905
             #endif // EXTRUDERS > 2
905
             #endif // EXTRUDERS > 2
906
           break;
906
           break;
907
           #if EXTRUDERS > 2
907
           #if EXTRUDERS > 2
908
             case 2:
908
             case 2:
909
-              enable_e2();
909
+              enable_E2();
910
               g_uc_extruder_last_move[2] = (BLOCK_BUFFER_SIZE) * 2;
910
               g_uc_extruder_last_move[2] = (BLOCK_BUFFER_SIZE) * 2;
911
-              if (g_uc_extruder_last_move[0] == 0) disable_e0();
912
-              if (g_uc_extruder_last_move[1] == 0) disable_e1();
911
+              if (g_uc_extruder_last_move[0] == 0) disable_E0();
912
+              if (g_uc_extruder_last_move[1] == 0) disable_E1();
913
               #if EXTRUDERS > 3
913
               #if EXTRUDERS > 3
914
-                if (g_uc_extruder_last_move[3] == 0) disable_e3();
914
+                if (g_uc_extruder_last_move[3] == 0) disable_E3();
915
                 #if EXTRUDERS > 4
915
                 #if EXTRUDERS > 4
916
-                  if (g_uc_extruder_last_move[4] == 0) disable_e4();
916
+                  if (g_uc_extruder_last_move[4] == 0) disable_E4();
917
                 #endif
917
                 #endif
918
               #endif
918
               #endif
919
             break;
919
             break;
920
             #if EXTRUDERS > 3
920
             #if EXTRUDERS > 3
921
               case 3:
921
               case 3:
922
-                enable_e3();
922
+                enable_E3();
923
                 g_uc_extruder_last_move[3] = (BLOCK_BUFFER_SIZE) * 2;
923
                 g_uc_extruder_last_move[3] = (BLOCK_BUFFER_SIZE) * 2;
924
-                if (g_uc_extruder_last_move[0] == 0) disable_e0();
925
-                if (g_uc_extruder_last_move[1] == 0) disable_e1();
926
-                if (g_uc_extruder_last_move[2] == 0) disable_e2();
924
+                if (g_uc_extruder_last_move[0] == 0) disable_E0();
925
+                if (g_uc_extruder_last_move[1] == 0) disable_E1();
926
+                if (g_uc_extruder_last_move[2] == 0) disable_E2();
927
                 #if EXTRUDERS > 4
927
                 #if EXTRUDERS > 4
928
-                  if (g_uc_extruder_last_move[4] == 0) disable_e4();
928
+                  if (g_uc_extruder_last_move[4] == 0) disable_E4();
929
                 #endif
929
                 #endif
930
               break;
930
               break;
931
               #if EXTRUDERS > 4
931
               #if EXTRUDERS > 4
932
                 case 4:
932
                 case 4:
933
-                  enable_e4();
933
+                  enable_E4();
934
                   g_uc_extruder_last_move[4] = (BLOCK_BUFFER_SIZE) * 2;
934
                   g_uc_extruder_last_move[4] = (BLOCK_BUFFER_SIZE) * 2;
935
-                  if (g_uc_extruder_last_move[0] == 0) disable_e0();
936
-                  if (g_uc_extruder_last_move[1] == 0) disable_e1();
937
-                  if (g_uc_extruder_last_move[2] == 0) disable_e2();
938
-                  if (g_uc_extruder_last_move[3] == 0) disable_e3();
935
+                  if (g_uc_extruder_last_move[0] == 0) disable_E0();
936
+                  if (g_uc_extruder_last_move[1] == 0) disable_E1();
937
+                  if (g_uc_extruder_last_move[2] == 0) disable_E2();
938
+                  if (g_uc_extruder_last_move[3] == 0) disable_E3();
939
                 break;
939
                 break;
940
               #endif // EXTRUDERS > 4
940
               #endif // EXTRUDERS > 4
941
             #endif // EXTRUDERS > 3
941
             #endif // EXTRUDERS > 3
943
         #endif // EXTRUDERS > 1
943
         #endif // EXTRUDERS > 1
944
       }
944
       }
945
     #else
945
     #else
946
-      enable_e0();
947
-      enable_e1();
948
-      enable_e2();
949
-      enable_e3();
950
-      enable_e4();
946
+      enable_E0();
947
+      enable_E1();
948
+      enable_E2();
949
+      enable_E3();
950
+      enable_E4();
951
     #endif
951
     #endif
952
   }
952
   }
953
 
953
 

+ 13
- 12
Marlin/stepper.cpp Просмотреть файл

428
 
428
 
429
       #if ENABLED(Z_LATE_ENABLE)
429
       #if ENABLED(Z_LATE_ENABLE)
430
         if (current_block->steps[Z_AXIS] > 0) {
430
         if (current_block->steps[Z_AXIS] > 0) {
431
-          enable_z();
431
+          enable_Z();
432
           _NEXT_ISR(2000); // Run at slow speed - 1 KHz
432
           _NEXT_ISR(2000); // Run at slow speed - 1 KHz
433
           _ENABLE_ISRs(); // re-enable ISRs
433
           _ENABLE_ISRs(); // re-enable ISRs
434
           return;
434
           return;
986
 
986
 
987
   #define _STEP_INIT(AXIS) AXIS ##_STEP_INIT
987
   #define _STEP_INIT(AXIS) AXIS ##_STEP_INIT
988
   #define _WRITE_STEP(AXIS, HIGHLOW) AXIS ##_STEP_WRITE(HIGHLOW)
988
   #define _WRITE_STEP(AXIS, HIGHLOW) AXIS ##_STEP_WRITE(HIGHLOW)
989
-  #define _DISABLE(axis) disable_## axis()
989
+  #define _DISABLE(AXIS) disable_## AXIS()
990
 
990
 
991
-  #define AXIS_INIT(axis, AXIS, PIN) \
991
+  #define AXIS_INIT(AXIS, PIN) \
992
     _STEP_INIT(AXIS); \
992
     _STEP_INIT(AXIS); \
993
     _WRITE_STEP(AXIS, _INVERT_STEP_PIN(PIN)); \
993
     _WRITE_STEP(AXIS, _INVERT_STEP_PIN(PIN)); \
994
-    _DISABLE(axis)
994
+    _DISABLE(AXIS)
995
 
995
 
996
-  #define E_AXIS_INIT(NUM) AXIS_INIT(e## NUM, E## NUM, E)
996
+  #define E_AXIS_INIT(NUM) AXIS_INIT(E## NUM, E)
997
 
997
 
998
   // Init Step Pins
998
   // Init Step Pins
999
   #if HAS_X_STEP
999
   #if HAS_X_STEP
1001
       X2_STEP_INIT;
1001
       X2_STEP_INIT;
1002
       X2_STEP_WRITE(INVERT_X_STEP_PIN);
1002
       X2_STEP_WRITE(INVERT_X_STEP_PIN);
1003
     #endif
1003
     #endif
1004
-    AXIS_INIT(x, X, X);
1004
+    AXIS_INIT(X, X);
1005
   #endif
1005
   #endif
1006
 
1006
 
1007
   #if HAS_Y_STEP
1007
   #if HAS_Y_STEP
1009
       Y2_STEP_INIT;
1009
       Y2_STEP_INIT;
1010
       Y2_STEP_WRITE(INVERT_Y_STEP_PIN);
1010
       Y2_STEP_WRITE(INVERT_Y_STEP_PIN);
1011
     #endif
1011
     #endif
1012
-    AXIS_INIT(y, Y, Y);
1012
+    AXIS_INIT(Y, Y);
1013
   #endif
1013
   #endif
1014
 
1014
 
1015
   #if HAS_Z_STEP
1015
   #if HAS_Z_STEP
1017
       Z2_STEP_INIT;
1017
       Z2_STEP_INIT;
1018
       Z2_STEP_WRITE(INVERT_Z_STEP_PIN);
1018
       Z2_STEP_WRITE(INVERT_Z_STEP_PIN);
1019
     #endif
1019
     #endif
1020
-    AXIS_INIT(z, Z, Z);
1020
+    AXIS_INIT(Z, Z);
1021
   #endif
1021
   #endif
1022
 
1022
 
1023
   #if HAS_E0_STEP
1023
   #if HAS_E0_STEP
1237
 
1237
 
1238
   #define CYCLES_EATEN_BY_BABYSTEP 60
1238
   #define CYCLES_EATEN_BY_BABYSTEP 60
1239
 
1239
 
1240
-  #define _ENABLE(axis) enable_## axis()
1240
+  #define _ENABLE(AXIS) enable_## AXIS()
1241
   #define _READ_DIR(AXIS) AXIS ##_DIR_READ
1241
   #define _READ_DIR(AXIS) AXIS ##_DIR_READ
1242
   #define _INVERT_DIR(AXIS) INVERT_## AXIS ##_DIR
1242
   #define _INVERT_DIR(AXIS) INVERT_## AXIS ##_DIR
1243
   #define _APPLY_DIR(AXIS, INVERT) AXIS ##_APPLY_DIR(INVERT, true)
1243
   #define _APPLY_DIR(AXIS, INVERT) AXIS ##_APPLY_DIR(INVERT, true)
1298
 
1298
 
1299
           bool z_direction = direction ^ BABYSTEP_INVERT_Z;
1299
           bool z_direction = direction ^ BABYSTEP_INVERT_Z;
1300
 
1300
 
1301
-          enable_x();
1302
-          enable_y();
1303
-          enable_z();
1301
+          enable_X();
1302
+          enable_Y();
1303
+          enable_Z();
1304
+
1304
           uint8_t old_x_dir_pin = X_DIR_READ,
1305
           uint8_t old_x_dir_pin = X_DIR_READ,
1305
                   old_y_dir_pin = Y_DIR_READ,
1306
                   old_y_dir_pin = Y_DIR_READ,
1306
                   old_z_dir_pin = Z_DIR_READ;
1307
                   old_z_dir_pin = Z_DIR_READ;

Загрузка…
Отмена
Сохранить