Browse Source

Minor code cleanup, move NUM_AXIS out of config

Scott Lahteine 10 years ago
parent
commit
e0d4368cb5

+ 4
- 2
Marlin/Configuration.h View File

529
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
529
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
530
 #endif
530
 #endif
531
 
531
 
532
-//// MOVEMENT SETTINGS
533
-#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
532
+/**
533
+ * MOVEMENT SETTINGS
534
+ */
535
+
534
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
536
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
535
 
537
 
536
 // default settings
538
 // default settings

+ 29
- 16
Marlin/Marlin.h View File

93
 void serial_echopair_P(const char *s_P, unsigned long v);
93
 void serial_echopair_P(const char *s_P, unsigned long v);
94
 
94
 
95
 
95
 
96
-//Things to write to serial from Program memory. Saves 400 to 2k of RAM.
97
-FORCE_INLINE void serialprintPGM(const char *str)
98
-{
99
-  char ch=pgm_read_byte(str);
100
-  while(ch)
101
-  {
96
+// Things to write to serial from Program memory. Saves 400 to 2k of RAM.
97
+FORCE_INLINE void serialprintPGM(const char *str) {
98
+  char ch = pgm_read_byte(str);
99
+  while(ch) {
102
     MYSERIAL.write(ch);
100
     MYSERIAL.write(ch);
103
-    ch=pgm_read_byte(++str);
101
+    ch = pgm_read_byte(++str);
104
   }
102
   }
105
 }
103
 }
106
 
104
 
107
-
108
 void get_command();
105
 void get_command();
109
 void process_commands();
106
 void process_commands();
110
 
107
 
148
 #endif
145
 #endif
149
 
146
 
150
 #if HAS_E0_ENABLE
147
 #if HAS_E0_ENABLE
151
-  #define enable_e0() E0_ENABLE_WRITE(E_ENABLE_ON)
148
+  #define enable_e0()  E0_ENABLE_WRITE( E_ENABLE_ON)
152
   #define disable_e0() E0_ENABLE_WRITE(!E_ENABLE_ON)
149
   #define disable_e0() E0_ENABLE_WRITE(!E_ENABLE_ON)
153
 #else
150
 #else
154
   #define enable_e0()  /* nothing */
151
   #define enable_e0()  /* nothing */
156
 #endif
153
 #endif
157
 
154
 
158
 #if (EXTRUDERS > 1) && HAS_E1_ENABLE
155
 #if (EXTRUDERS > 1) && HAS_E1_ENABLE
159
-  #define enable_e1() E1_ENABLE_WRITE(E_ENABLE_ON)
156
+  #define enable_e1()  E1_ENABLE_WRITE( E_ENABLE_ON)
160
   #define disable_e1() E1_ENABLE_WRITE(!E_ENABLE_ON)
157
   #define disable_e1() E1_ENABLE_WRITE(!E_ENABLE_ON)
161
 #else
158
 #else
162
   #define enable_e1()  /* nothing */
159
   #define enable_e1()  /* nothing */
164
 #endif
161
 #endif
165
 
162
 
166
 #if (EXTRUDERS > 2) && HAS_E2_ENABLE
163
 #if (EXTRUDERS > 2) && HAS_E2_ENABLE
167
-  #define enable_e2() E2_ENABLE_WRITE(E_ENABLE_ON)
164
+  #define enable_e2()  E2_ENABLE_WRITE( E_ENABLE_ON)
168
   #define disable_e2() E2_ENABLE_WRITE(!E_ENABLE_ON)
165
   #define disable_e2() E2_ENABLE_WRITE(!E_ENABLE_ON)
169
 #else
166
 #else
170
   #define enable_e2()  /* nothing */
167
   #define enable_e2()  /* nothing */
172
 #endif
169
 #endif
173
 
170
 
174
 #if (EXTRUDERS > 3) && HAS_E3_ENABLE
171
 #if (EXTRUDERS > 3) && HAS_E3_ENABLE
175
-  #define enable_e3() E3_ENABLE_WRITE(E_ENABLE_ON)
172
+  #define enable_e3()  E3_ENABLE_WRITE( E_ENABLE_ON)
176
   #define disable_e3() E3_ENABLE_WRITE(!E_ENABLE_ON)
173
   #define disable_e3() E3_ENABLE_WRITE(!E_ENABLE_ON)
177
 #else
174
 #else
178
   #define enable_e3()  /* nothing */
175
   #define enable_e3()  /* nothing */
179
   #define disable_e3() /* nothing */
176
   #define disable_e3() /* nothing */
180
 #endif
177
 #endif
181
 
178
 
179
+/**
180
+ * The axis order in all axis related arrays is X, Y, Z, E
181
+ */
182
+#define NUM_AXIS 4
183
+
184
+/**
185
+ * Axis indices as enumerated constants
186
+ *
187
+ * A_AXIS and B_AXIS are used by COREXY printers
188
+ * X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots.
189
+ */
182
 enum AxisEnum {X_AXIS=0, Y_AXIS=1, A_AXIS=0, B_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5};
190
 enum AxisEnum {X_AXIS=0, Y_AXIS=1, A_AXIS=0, B_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5};
183
-//X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots.
184
 
191
 
185
 void FlushSerialRequestResend();
192
 void FlushSerialRequestResend();
186
 void ClearToSend();
193
 void ClearToSend();
224
 #ifndef CRITICAL_SECTION_START
231
 #ifndef CRITICAL_SECTION_START
225
   #define CRITICAL_SECTION_START  unsigned char _sreg = SREG; cli();
232
   #define CRITICAL_SECTION_START  unsigned char _sreg = SREG; cli();
226
   #define CRITICAL_SECTION_END    SREG = _sreg;
233
   #define CRITICAL_SECTION_END    SREG = _sreg;
227
-#endif //CRITICAL_SECTION_START
234
+#endif
228
 
235
 
229
 extern float homing_feedrate[];
236
 extern float homing_feedrate[];
230
 extern bool axis_relative_modes[];
237
 extern bool axis_relative_modes[];
233
 extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually
240
 extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually
234
 extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
241
 extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
235
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
242
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
236
-extern float current_position[NUM_AXIS] ;
243
+extern float current_position[NUM_AXIS];
237
 extern float home_offset[3];
244
 extern float home_offset[3];
245
+
238
 #ifdef DELTA
246
 #ifdef DELTA
239
   extern float endstop_adj[3];
247
   extern float endstop_adj[3];
240
   extern float delta_radius;
248
   extern float delta_radius;
242
   extern float delta_segments_per_second;
250
   extern float delta_segments_per_second;
243
   void recalc_delta_settings(float radius, float diagonal_rod);
251
   void recalc_delta_settings(float radius, float diagonal_rod);
244
 #elif defined(Z_DUAL_ENDSTOPS)
252
 #elif defined(Z_DUAL_ENDSTOPS)
245
-extern float z_endstop_adj;
253
+  extern float z_endstop_adj;
246
 #endif
254
 #endif
255
+
247
 #ifdef SCARA
256
 #ifdef SCARA
248
   extern float axis_scaling[3];  // Build size scaling
257
   extern float axis_scaling[3];  // Build size scaling
249
 #endif
258
 #endif
259
+
250
 extern float min_pos[3];
260
 extern float min_pos[3];
251
 extern float max_pos[3];
261
 extern float max_pos[3];
252
 extern bool axis_known_position[3];
262
 extern bool axis_known_position[3];
263
+
253
 #ifdef ENABLE_AUTO_BED_LEVELING
264
 #ifdef ENABLE_AUTO_BED_LEVELING
254
   extern float zprobe_zoffset;
265
   extern float zprobe_zoffset;
255
 #endif
266
 #endif
267
+
256
 extern int fanSpeed;
268
 extern int fanSpeed;
269
+
257
 #ifdef BARICUDA
270
 #ifdef BARICUDA
258
   extern int ValvePressure;
271
   extern int ValvePressure;
259
   extern int EtoPPressure;
272
   extern int EtoPPressure;

+ 4
- 2
Marlin/configurator/config/Configuration.h View File

553
 
553
 
554
 // @section movement
554
 // @section movement
555
 
555
 
556
-//// MOVEMENT SETTINGS
557
-#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
556
+/**
557
+ * MOVEMENT SETTINGS
558
+ */
559
+
558
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
560
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
559
 
561
 
560
 // default settings
562
 // default settings

+ 4
- 2
Marlin/example_configurations/Felix/Configuration.h View File

499
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
499
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
500
 #endif
500
 #endif
501
 
501
 
502
-//// MOVEMENT SETTINGS
503
-#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
502
+/**
503
+ * MOVEMENT SETTINGS
504
+ */
505
+
504
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
506
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
505
 
507
 
506
 // default settings
508
 // default settings

+ 4
- 2
Marlin/example_configurations/Felix/Configuration_DUAL.h View File

499
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
499
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
500
 #endif
500
 #endif
501
 
501
 
502
-//// MOVEMENT SETTINGS
503
-#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
502
+/**
503
+ * MOVEMENT SETTINGS
504
+ */
505
+
504
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
506
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
505
 
507
 
506
 // default settings
508
 // default settings

+ 4
- 2
Marlin/example_configurations/Hephestos/Configuration.h View File

522
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
522
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
523
 #endif
523
 #endif
524
 
524
 
525
-//// MOVEMENT SETTINGS
526
-#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
525
+/**
526
+ * MOVEMENT SETTINGS
527
+ */
528
+
527
 #define HOMING_FEEDRATE {2000, 2000, 150, 0}  // set the homing speeds (mm/min)
529
 #define HOMING_FEEDRATE {2000, 2000, 150, 0}  // set the homing speeds (mm/min)
528
 
530
 
529
 // default settings
531
 // default settings

+ 4
- 2
Marlin/example_configurations/K8200/Configuration.h View File

527
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
527
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
528
 #endif
528
 #endif
529
 
529
 
530
-//// MOVEMENT SETTINGS
531
-#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
530
+/**
531
+ * MOVEMENT SETTINGS
532
+ */
533
+
532
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
534
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
533
 
535
 
534
 // default settings
536
 // default settings

+ 4
- 2
Marlin/example_configurations/SCARA/Configuration.h View File

551
   #define MANUAL_Z_HOME_POS 0.1  // Distance between nozzle and print surface after homing.
551
   #define MANUAL_Z_HOME_POS 0.1  // Distance between nozzle and print surface after homing.
552
 #endif
552
 #endif
553
 
553
 
554
-//// MOVEMENT SETTINGS
555
-#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
554
+/**
555
+ * MOVEMENT SETTINGS
556
+ */
557
+
556
 #define HOMING_FEEDRATE {40*60, 40*60, 10*60, 0}  // set the homing speeds (mm/min)
558
 #define HOMING_FEEDRATE {40*60, 40*60, 10*60, 0}  // set the homing speeds (mm/min)
557
 
559
 
558
 // default settings
560
 // default settings

+ 4
- 2
Marlin/example_configurations/WITBOX/Configuration.h View File

521
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
521
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
522
 #endif
522
 #endif
523
 
523
 
524
-//// MOVEMENT SETTINGS
525
-#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
524
+/**
525
+ * MOVEMENT SETTINGS
526
+ */
527
+
526
 #define HOMING_FEEDRATE {120*60, 120*60, 7.2*60, 0}  // set the homing speeds (mm/min)
528
 #define HOMING_FEEDRATE {120*60, 120*60, 7.2*60, 0}  // set the homing speeds (mm/min)
527
 
529
 
528
 // default settings
530
 // default settings

+ 4
- 2
Marlin/example_configurations/delta/generic/Configuration.h View File

566
   #define MANUAL_Z_HOME_POS 250 // For delta: Distance between nozzle and print surface after homing.
566
   #define MANUAL_Z_HOME_POS 250 // For delta: Distance between nozzle and print surface after homing.
567
 #endif
567
 #endif
568
 
568
 
569
-//// MOVEMENT SETTINGS
570
-#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
569
+/**
570
+ * MOVEMENT SETTINGS
571
+ */
572
+
571
 
573
 
572
 // delta homing speeds must be the same on xyz
574
 // delta homing speeds must be the same on xyz
573
 #define HOMING_FEEDRATE {200*60, 200*60, 200*60, 0}  // set the homing speeds (mm/min)
575
 #define HOMING_FEEDRATE {200*60, 200*60, 200*60, 0}  // set the homing speeds (mm/min)

+ 4
- 2
Marlin/example_configurations/delta/kossel_mini/Configuration.h View File

570
   #define MANUAL_Z_HOME_POS 250 // For delta: Distance between nozzle and print surface after homing.
570
   #define MANUAL_Z_HOME_POS 250 // For delta: Distance between nozzle and print surface after homing.
571
 #endif
571
 #endif
572
 
572
 
573
-//// MOVEMENT SETTINGS
574
-#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
573
+/**
574
+ * MOVEMENT SETTINGS
575
+ */
576
+
575
 
577
 
576
 // delta homing speeds must be the same on xyz
578
 // delta homing speeds must be the same on xyz
577
 #define HOMING_FEEDRATE {200*60, 200*60, 200*60, 0}  // set the homing speeds (mm/min)
579
 #define HOMING_FEEDRATE {200*60, 200*60, 200*60, 0}  // set the homing speeds (mm/min)

+ 4
- 2
Marlin/example_configurations/makibox/Configuration.h View File

519
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
519
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
520
 #endif
520
 #endif
521
 
521
 
522
-//// MOVEMENT SETTINGS
523
-#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
522
+/**
523
+ * MOVEMENT SETTINGS
524
+ */
525
+
524
 #define HOMING_FEEDRATE {1500, 1500, 120, 0}  // set the homing speeds (mm/min)   ***** MakiBox A6 *****
526
 #define HOMING_FEEDRATE {1500, 1500, 120, 0}  // set the homing speeds (mm/min)   ***** MakiBox A6 *****
525
 
527
 
526
 // default settings
528
 // default settings

+ 4
- 2
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

521
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
521
   //#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
522
 #endif
522
 #endif
523
 
523
 
524
-//// MOVEMENT SETTINGS
525
-#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
524
+/**
525
+ * MOVEMENT SETTINGS
526
+ */
527
+
526
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
528
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
527
 
529
 
528
 // default settings
530
 // default settings

+ 3
- 3
Marlin/planner.cpp View File

614
         #if EXTRUDERS > 1
614
         #if EXTRUDERS > 1
615
           case 1:
615
           case 1:
616
             enable_e1();
616
             enable_e1();
617
-            g_uc_extruder_last_move[1] = BLOCK_BUFFER_SIZE*2;
617
+            g_uc_extruder_last_move[1] = BLOCK_BUFFER_SIZE * 2;
618
             if (g_uc_extruder_last_move[0] == 0) disable_e0();
618
             if (g_uc_extruder_last_move[0] == 0) disable_e0();
619
             #if EXTRUDERS > 2
619
             #if EXTRUDERS > 2
620
               if (g_uc_extruder_last_move[2] == 0) disable_e2();
620
               if (g_uc_extruder_last_move[2] == 0) disable_e2();
626
           #if EXTRUDERS > 2
626
           #if EXTRUDERS > 2
627
             case 2:
627
             case 2:
628
               enable_e2();
628
               enable_e2();
629
-              g_uc_extruder_last_move[2] = BLOCK_BUFFER_SIZE*2;
629
+              g_uc_extruder_last_move[2] = BLOCK_BUFFER_SIZE * 2;
630
               if (g_uc_extruder_last_move[0] == 0) disable_e0();
630
               if (g_uc_extruder_last_move[0] == 0) disable_e0();
631
               if (g_uc_extruder_last_move[1] == 0) disable_e1();
631
               if (g_uc_extruder_last_move[1] == 0) disable_e1();
632
               #if EXTRUDERS > 3
632
               #if EXTRUDERS > 3
636
             #if EXTRUDERS > 3
636
             #if EXTRUDERS > 3
637
               case 3:
637
               case 3:
638
                 enable_e3();
638
                 enable_e3();
639
-                g_uc_extruder_last_move[3] = BLOCK_BUFFER_SIZE*2;
639
+                g_uc_extruder_last_move[3] = BLOCK_BUFFER_SIZE * 2;
640
                 if (g_uc_extruder_last_move[0] == 0) disable_e0();
640
                 if (g_uc_extruder_last_move[0] == 0) disable_e0();
641
                 if (g_uc_extruder_last_move[1] == 0) disable_e1();
641
                 if (g_uc_extruder_last_move[1] == 0) disable_e1();
642
                 if (g_uc_extruder_last_move[2] == 0) disable_e2();
642
                 if (g_uc_extruder_last_move[2] == 0) disable_e2();

Loading…
Cancel
Save