ソースを参照

Using axis constants

Scott Lahteine 10年前
コミット
07c6b5ab71

+ 23
- 23
Marlin/ConfigurationStore.cpp ファイルの表示

@@ -116,38 +116,38 @@ void Config_PrintSettings()
116 116
     SERIAL_ECHO_START;
117 117
     SERIAL_ECHOLNPGM("Steps per unit:");
118 118
     SERIAL_ECHO_START;
119
-    SERIAL_ECHOPAIR("  M92 X",axis_steps_per_unit[0]);
120
-    SERIAL_ECHOPAIR(" Y",axis_steps_per_unit[1]);
121
-    SERIAL_ECHOPAIR(" Z",axis_steps_per_unit[2]);
122
-    SERIAL_ECHOPAIR(" E",axis_steps_per_unit[3]);
119
+    SERIAL_ECHOPAIR("  M92 X",axis_steps_per_unit[X_AXIS]);
120
+    SERIAL_ECHOPAIR(" Y",axis_steps_per_unit[Y_AXIS]);
121
+    SERIAL_ECHOPAIR(" Z",axis_steps_per_unit[Z_AXIS]);
122
+    SERIAL_ECHOPAIR(" E",axis_steps_per_unit[E_AXIS]);
123 123
     SERIAL_ECHOLN("");
124 124
       
125 125
     SERIAL_ECHO_START;
126 126
 #ifdef SCARA
127 127
 SERIAL_ECHOLNPGM("Scaling factors:");
128 128
     SERIAL_ECHO_START;
129
-    SERIAL_ECHOPAIR("  M365 X",axis_scaling[0]);
130
-    SERIAL_ECHOPAIR(" Y",axis_scaling[1]);
131
-    SERIAL_ECHOPAIR(" Z",axis_scaling[2]);
129
+    SERIAL_ECHOPAIR("  M365 X",axis_scaling[X_AXIS]);
130
+    SERIAL_ECHOPAIR(" Y",axis_scaling[Y_AXIS]);
131
+    SERIAL_ECHOPAIR(" Z",axis_scaling[Z_AXIS]);
132 132
     SERIAL_ECHOLN("");
133 133
       
134 134
     SERIAL_ECHO_START;
135 135
 #endif
136 136
     SERIAL_ECHOLNPGM("Maximum feedrates (mm/s):");
137 137
     SERIAL_ECHO_START;
138
-    SERIAL_ECHOPAIR("  M203 X",max_feedrate[0]);
139
-    SERIAL_ECHOPAIR(" Y",max_feedrate[1] ); 
140
-    SERIAL_ECHOPAIR(" Z", max_feedrate[2] ); 
141
-    SERIAL_ECHOPAIR(" E", max_feedrate[3]);
138
+    SERIAL_ECHOPAIR("  M203 X", max_feedrate[X_AXIS]);
139
+    SERIAL_ECHOPAIR(" Y", max_feedrate[Y_AXIS]); 
140
+    SERIAL_ECHOPAIR(" Z", max_feedrate[Z_AXIS]); 
141
+    SERIAL_ECHOPAIR(" E", max_feedrate[E_AXIS]);
142 142
     SERIAL_ECHOLN("");
143 143
 
144 144
     SERIAL_ECHO_START;
145 145
     SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):");
146 146
     SERIAL_ECHO_START;
147
-    SERIAL_ECHOPAIR("  M201 X" ,max_acceleration_units_per_sq_second[0] ); 
148
-    SERIAL_ECHOPAIR(" Y" , max_acceleration_units_per_sq_second[1] ); 
149
-    SERIAL_ECHOPAIR(" Z" ,max_acceleration_units_per_sq_second[2] );
150
-    SERIAL_ECHOPAIR(" E" ,max_acceleration_units_per_sq_second[3]);
147
+    SERIAL_ECHOPAIR("  M201 X" ,max_acceleration_units_per_sq_second[X_AXIS] ); 
148
+    SERIAL_ECHOPAIR(" Y" , max_acceleration_units_per_sq_second[Y_AXIS] ); 
149
+    SERIAL_ECHOPAIR(" Z" ,max_acceleration_units_per_sq_second[Z_AXIS] );
150
+    SERIAL_ECHOPAIR(" E" ,max_acceleration_units_per_sq_second[E_AXIS]);
151 151
     SERIAL_ECHOLN("");
152 152
     SERIAL_ECHO_START;
153 153
     SERIAL_ECHOLNPGM("Acceleration: S=acceleration, T=retract acceleration");
@@ -170,17 +170,17 @@ SERIAL_ECHOLNPGM("Scaling factors:");
170 170
     SERIAL_ECHO_START;
171 171
     SERIAL_ECHOLNPGM("Home offset (mm):");
172 172
     SERIAL_ECHO_START;
173
-    SERIAL_ECHOPAIR("  M206 X",add_homing[0] );
174
-    SERIAL_ECHOPAIR(" Y" ,add_homing[1] );
175
-    SERIAL_ECHOPAIR(" Z" ,add_homing[2] );
173
+    SERIAL_ECHOPAIR("  M206 X",add_homing[X_AXIS] );
174
+    SERIAL_ECHOPAIR(" Y" ,add_homing[Y_AXIS] );
175
+    SERIAL_ECHOPAIR(" Z" ,add_homing[Z_AXIS] );
176 176
     SERIAL_ECHOLN("");
177 177
 #ifdef DELTA
178 178
     SERIAL_ECHO_START;
179 179
     SERIAL_ECHOLNPGM("Endstop adjustement (mm):");
180 180
     SERIAL_ECHO_START;
181
-    SERIAL_ECHOPAIR("  M666 X",endstop_adj[0] );
182
-    SERIAL_ECHOPAIR(" Y" ,endstop_adj[1] );
183
-    SERIAL_ECHOPAIR(" Z" ,endstop_adj[2] );
181
+    SERIAL_ECHOPAIR("  M666 X",endstop_adj[X_AXIS] );
182
+    SERIAL_ECHOPAIR(" Y" ,endstop_adj[Y_AXIS] );
183
+    SERIAL_ECHOPAIR(" Z" ,endstop_adj[Z_AXIS] );
184 184
 	SERIAL_ECHOLN("");
185 185
 	SERIAL_ECHO_START;
186 186
 	SERIAL_ECHOLNPGM("Delta settings: L=delta_diagonal_rod, R=delta_radius, S=delta_segments_per_second");
@@ -303,9 +303,9 @@ void Config_ResetDefault()
303 303
     max_xy_jerk=DEFAULT_XYJERK;
304 304
     max_z_jerk=DEFAULT_ZJERK;
305 305
     max_e_jerk=DEFAULT_EJERK;
306
-    add_homing[0] = add_homing[1] = add_homing[2] = 0;
306
+    add_homing[X_AXIS] = add_homing[Y_AXIS] = add_homing[Z_AXIS] = 0;
307 307
 #ifdef DELTA
308
-	endstop_adj[0] = endstop_adj[1] = endstop_adj[2] = 0;
308
+	endstop_adj[X_AXIS] = endstop_adj[Y_AXIS] = endstop_adj[Z_AXIS] = 0;
309 309
 	delta_radius= DELTA_RADIUS;
310 310
 	delta_diagonal_rod= DELTA_DIAGONAL_ROD;
311 311
 	delta_segments_per_second= DELTA_SEGMENTS_PER_SECOND;

+ 2
- 2
Marlin/Configuration_adv.h ファイルの表示

@@ -345,8 +345,8 @@
345 345
 
346 346
   #define D_FILAMENT 2.85
347 347
   #define STEPS_MM_E 836
348
-  #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
349
-  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA)
348
+  #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
349
+  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
350 350
 
351 351
 #endif // ADVANCE
352 352
 

+ 30
- 30
Marlin/Marlin_main.cpp ファイルの表示

@@ -1537,7 +1537,7 @@ void process_commands()
1537 1537
 		#ifdef SCARA
1538 1538
 		   current_position[X_AXIS]=code_value();
1539 1539
 		#else
1540
-		   current_position[X_AXIS]=code_value()+add_homing[0];
1540
+		   current_position[X_AXIS]=code_value()+add_homing[X_AXIS];
1541 1541
 		#endif
1542 1542
         }
1543 1543
       }
@@ -1547,7 +1547,7 @@ void process_commands()
1547 1547
          #ifdef SCARA
1548 1548
 		   current_position[Y_AXIS]=code_value();
1549 1549
 		#else
1550
-		   current_position[Y_AXIS]=code_value()+add_homing[1];
1550
+		   current_position[Y_AXIS]=code_value()+add_homing[Y_AXIS];
1551 1551
 		#endif
1552 1552
         }
1553 1553
       }
@@ -1612,7 +1612,7 @@ void process_commands()
1612 1612
 
1613 1613
       if(code_seen(axis_codes[Z_AXIS])) {
1614 1614
         if(code_value_long() != 0) {
1615
-          current_position[Z_AXIS]=code_value()+add_homing[2];
1615
+          current_position[Z_AXIS]=code_value()+add_homing[Z_AXIS];
1616 1616
         }
1617 1617
       }
1618 1618
       #ifdef ENABLE_AUTO_BED_LEVELING
@@ -2745,9 +2745,9 @@ Sigma_Exit:
2745 2745
       SERIAL_PROTOCOLLN("");
2746 2746
       
2747 2747
       SERIAL_PROTOCOLPGM("SCARA Cal - Theta:");
2748
-      SERIAL_PROTOCOL(delta[X_AXIS]+add_homing[0]);
2748
+      SERIAL_PROTOCOL(delta[X_AXIS]+add_homing[X_AXIS]);
2749 2749
       SERIAL_PROTOCOLPGM("   Psi+Theta (90):");
2750
-      SERIAL_PROTOCOL(delta[Y_AXIS]-delta[X_AXIS]-90+add_homing[1]);
2750
+      SERIAL_PROTOCOL(delta[Y_AXIS]-delta[X_AXIS]-90+add_homing[Y_AXIS]);
2751 2751
       SERIAL_PROTOCOLLN("");
2752 2752
       
2753 2753
       SERIAL_PROTOCOLPGM("SCARA step Cal - Theta:");
@@ -2883,11 +2883,11 @@ Sigma_Exit:
2883 2883
 	  #ifdef SCARA
2884 2884
 	   if(code_seen('T'))       // Theta
2885 2885
       {
2886
-        add_homing[0] = code_value() ;
2886
+        add_homing[X_AXIS] = code_value() ;
2887 2887
       }
2888 2888
       if(code_seen('P'))       // Psi
2889 2889
       {
2890
-        add_homing[1] = code_value() ;
2890
+        add_homing[Y_AXIS] = code_value() ;
2891 2891
       }
2892 2892
 	  #endif
2893 2893
       break;
@@ -3275,11 +3275,11 @@ Sigma_Exit:
3275 3275
       //SERIAL_ECHOLN(" Soft endstops disabled ");
3276 3276
       if(Stopped == false) {
3277 3277
         //get_coordinates(); // For X Y Z E F
3278
-        delta[0] = 0;
3279
-        delta[1] = 120;
3278
+        delta[X_AXIS] = 0;
3279
+        delta[Y_AXIS] = 120;
3280 3280
         calculate_SCARA_forward_Transform(delta);
3281
-        destination[0] = delta[0]/axis_scaling[X_AXIS];
3282
-        destination[1] = delta[1]/axis_scaling[Y_AXIS];
3281
+        destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS];
3282
+        destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS];
3283 3283
         
3284 3284
         prepare_move();
3285 3285
         //ClearToSend();
@@ -3293,11 +3293,11 @@ Sigma_Exit:
3293 3293
       //SERIAL_ECHOLN(" Soft endstops disabled ");
3294 3294
       if(Stopped == false) {
3295 3295
         //get_coordinates(); // For X Y Z E F
3296
-        delta[0] = 90;
3297
-        delta[1] = 130;
3296
+        delta[X_AXIS] = 90;
3297
+        delta[Y_AXIS] = 130;
3298 3298
         calculate_SCARA_forward_Transform(delta);
3299
-        destination[0] = delta[0]/axis_scaling[X_AXIS];
3300
-        destination[1] = delta[1]/axis_scaling[Y_AXIS];
3299
+        destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS];
3300
+        destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS];
3301 3301
         
3302 3302
         prepare_move();
3303 3303
         //ClearToSend();
@@ -3310,11 +3310,11 @@ Sigma_Exit:
3310 3310
       //SERIAL_ECHOLN(" Soft endstops disabled ");
3311 3311
       if(Stopped == false) {
3312 3312
         //get_coordinates(); // For X Y Z E F
3313
-        delta[0] = 60;
3314
-        delta[1] = 180;
3313
+        delta[X_AXIS] = 60;
3314
+        delta[Y_AXIS] = 180;
3315 3315
         calculate_SCARA_forward_Transform(delta);
3316
-        destination[0] = delta[0]/axis_scaling[X_AXIS];
3317
-        destination[1] = delta[1]/axis_scaling[Y_AXIS];
3316
+        destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS];
3317
+        destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS];
3318 3318
         
3319 3319
         prepare_move();
3320 3320
         //ClearToSend();
@@ -3327,11 +3327,11 @@ Sigma_Exit:
3327 3327
       //SERIAL_ECHOLN(" Soft endstops disabled ");
3328 3328
       if(Stopped == false) {
3329 3329
         //get_coordinates(); // For X Y Z E F
3330
-        delta[0] = 50;
3331
-        delta[1] = 90;
3330
+        delta[X_AXIS] = 50;
3331
+        delta[Y_AXIS] = 90;
3332 3332
         calculate_SCARA_forward_Transform(delta);
3333
-        destination[0] = delta[0]/axis_scaling[X_AXIS];
3334
-        destination[1] = delta[1]/axis_scaling[Y_AXIS];
3333
+        destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS];
3334
+        destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS];
3335 3335
         
3336 3336
         prepare_move();
3337 3337
         //ClearToSend();
@@ -3344,11 +3344,11 @@ Sigma_Exit:
3344 3344
       //SERIAL_ECHOLN(" Soft endstops disabled ");
3345 3345
       if(Stopped == false) {
3346 3346
         //get_coordinates(); // For X Y Z E F
3347
-        delta[0] = 45;
3348
-        delta[1] = 135;
3347
+        delta[X_AXIS] = 45;
3348
+        delta[Y_AXIS] = 135;
3349 3349
         calculate_SCARA_forward_Transform(delta);
3350
-        destination[0] = delta[0]/axis_scaling[X_AXIS];
3351
-        destination[1] = delta[1]/axis_scaling[Y_AXIS]; 
3350
+        destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS];
3351
+        destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS]; 
3352 3352
         
3353 3353
         prepare_move();
3354 3354
         //ClearToSend();
@@ -4020,9 +4020,9 @@ for (int s = 1; s <= steps; s++) {
4020 4020
 
4021 4021
 	
4022 4022
 	calculate_delta(destination);
4023
-         //SERIAL_ECHOPGM("destination[0]="); SERIAL_ECHOLN(destination[0]);
4024
-         //SERIAL_ECHOPGM("destination[1]="); SERIAL_ECHOLN(destination[1]);
4025
-         //SERIAL_ECHOPGM("destination[2]="); SERIAL_ECHOLN(destination[2]);
4023
+         //SERIAL_ECHOPGM("destination[X_AXIS]="); SERIAL_ECHOLN(destination[X_AXIS]);
4024
+         //SERIAL_ECHOPGM("destination[Y_AXIS]="); SERIAL_ECHOLN(destination[Y_AXIS]);
4025
+         //SERIAL_ECHOPGM("destination[Z_AXIS]="); SERIAL_ECHOLN(destination[Z_AXIS]);
4026 4026
          //SERIAL_ECHOPGM("delta[X_AXIS]="); SERIAL_ECHOLN(delta[X_AXIS]);
4027 4027
          //SERIAL_ECHOPGM("delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]);
4028 4028
          //SERIAL_ECHOPGM("delta[Z_AXIS]="); SERIAL_ECHOLN(delta[Z_AXIS]);

+ 2
- 2
Marlin/example_configurations/SCARA/Configuration_adv.h ファイルの表示

@@ -353,8 +353,8 @@
353 353
 
354 354
   #define D_FILAMENT 1.75
355 355
   #define STEPS_MM_E 1000
356
-  #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
357
-  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA)
356
+  #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
357
+  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
358 358
 
359 359
 #endif // ADVANCE
360 360
 

+ 2
- 2
Marlin/example_configurations/delta/Configuration_adv.h ファイルの表示

@@ -340,8 +340,8 @@
340 340
 
341 341
   #define D_FILAMENT 2.85
342 342
   #define STEPS_MM_E 836
343
-  #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
344
-  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA)
343
+  #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
344
+  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
345 345
 
346 346
 #endif // ADVANCE
347 347
 

+ 2
- 2
Marlin/example_configurations/makibox/Configuration_adv.h ファイルの表示

@@ -344,8 +344,8 @@
344 344
 
345 345
   #define D_FILAMENT 2.85
346 346
   #define STEPS_MM_E 836
347
-  #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
348
-  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA)
347
+  #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
348
+  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
349 349
 
350 350
 #endif // ADVANCE
351 351
 

+ 6
- 6
Marlin/planner.cpp ファイルの表示

@@ -63,9 +63,9 @@
63 63
 //===========================================================================
64 64
 
65 65
 unsigned long minsegmenttime;
66
-float max_feedrate[4]; // set the max speeds
67
-float axis_steps_per_unit[4];
68
-unsigned long max_acceleration_units_per_sq_second[4]; // Use M201 to override by software
66
+float max_feedrate[NUM_AXIS]; // set the max speeds
67
+float axis_steps_per_unit[NUM_AXIS];
68
+unsigned long max_acceleration_units_per_sq_second[NUM_AXIS]; // Use M201 to override by software
69 69
 float minimumfeedrate;
70 70
 float acceleration;         // Normal acceleration mm/s^2  THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX
71 71
 float retract_acceleration; //  mm/s^2   filament pull-pack and push-forward  while standing still in the other axis M204 TXXXX
@@ -85,8 +85,8 @@ matrix_3x3 plan_bed_level_matrix = {
85 85
 #endif // #ifdef ENABLE_AUTO_BED_LEVELING
86 86
 
87 87
 // The current position of the tool in absolute steps
88
-long position[4];   //rescaled from extern when axis_steps_per_unit are changed by gcode
89
-static float previous_speed[4]; // Speed of previous path line segment
88
+long position[NUM_AXIS];   //rescaled from extern when axis_steps_per_unit are changed by gcode
89
+static float previous_speed[NUM_AXIS]; // Speed of previous path line segment
90 90
 static float previous_nominal_speed; // Nominal speed of previous path line segment
91 91
 
92 92
 #ifdef AUTOTEMP
@@ -989,7 +989,7 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi
989 989
   else {
990 990
     long acc_dist = estimate_acceleration_distance(0, block->nominal_rate, block->acceleration_st);
991 991
     float advance = (STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K) * 
992
-      (current_speed[E_AXIS] * current_speed[E_AXIS] * EXTRUTION_AREA * EXTRUTION_AREA)*256;
992
+      (current_speed[E_AXIS] * current_speed[E_AXIS] * EXTRUSION_AREA * EXTRUSION_AREA)*256;
993 993
     block->advance = advance;
994 994
     if(acc_dist == 0) {
995 995
       block->advance_rate = 0;

+ 4
- 11
Marlin/planner.h ファイルの表示

@@ -106,9 +106,9 @@ void check_axes_activity();
106 106
 uint8_t movesplanned(); //return the nr of buffered moves
107 107
 
108 108
 extern unsigned long minsegmenttime;
109
-extern float max_feedrate[4]; // set the max speeds
110
-extern float axis_steps_per_unit[4];
111
-extern unsigned long max_acceleration_units_per_sq_second[4]; // Use M201 to override by software
109
+extern float max_feedrate[NUM_AXIS]; // set the max speeds
110
+extern float axis_steps_per_unit[NUM_AXIS];
111
+extern unsigned long max_acceleration_units_per_sq_second[NUM_AXIS]; // Use M201 to override by software
112 112
 extern float minimumfeedrate;
113 113
 extern float acceleration;         // Normal acceleration mm/s^2  THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX
114 114
 extern float retract_acceleration; //  mm/s^2   filament pull-pack and push-forward  while standing still in the other axis M204 TXXXX
@@ -152,14 +152,7 @@ FORCE_INLINE block_t *plan_get_current_block()
152 152
 }
153 153
 
154 154
 // Returns true if the buffer has a queued block, false otherwise
155
-FORCE_INLINE bool blocks_queued() 
156
-{
157
-  if (block_buffer_head == block_buffer_tail) { 
158
-    return false; 
159
-  }
160
-  else
161
-    return true;
162
-}
155
+FORCE_INLINE bool blocks_queued() { return (block_buffer_head != block_buffer_tail); }
163 156
 
164 157
 #ifdef PREVENT_DANGEROUS_EXTRUDE
165 158
 void set_extrude_min_temp(float temp);

読み込み中…
キャンセル
保存