浏览代码

Use ABC and XYZ for "3"

Scott Lahteine 8 年前
父节点
当前提交
2f223b8c79
共有 6 个文件被更改,包括 40 次插入40 次删除
  1. 12
    12
      Marlin/Marlin.h
  2. 24
    24
      Marlin/Marlin_main.cpp
  3. 1
    1
      Marlin/planner.cpp
  4. 1
    1
      Marlin/stepper.cpp
  5. 1
    1
      Marlin/stepper.h
  6. 1
    1
      Marlin/temperature.cpp

+ 12
- 12
Marlin/Marlin.h 查看文件

@@ -266,13 +266,13 @@ extern bool volumetric_enabled;
266 266
 extern int flow_percentage[EXTRUDERS]; // Extrusion factor for each extruder
267 267
 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.
268 268
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
269
-extern bool axis_known_position[3]; // axis[n].is_known
270
-extern bool axis_homed[3]; // axis[n].is_homed
269
+extern bool axis_known_position[XYZ]; // axis[n].is_known
270
+extern bool axis_homed[XYZ]; // axis[n].is_homed
271 271
 extern volatile bool wait_for_heatup;
272 272
 
273 273
 extern float current_position[NUM_AXIS];
274
-extern float position_shift[3];
275
-extern float home_offset[3];
274
+extern float position_shift[XYZ];
275
+extern float home_offset[XYZ];
276 276
 
277 277
 // Software Endstops
278 278
 void update_software_endstops(AxisEnum axis);
@@ -303,25 +303,25 @@ float code_value_temp_abs();
303 303
 float code_value_temp_diff();
304 304
 
305 305
 #if ENABLED(DELTA)
306
-  extern float delta[3];
307
-  extern float endstop_adj[3]; // axis[n].endstop_adj
306
+  extern float delta[ABC];
307
+  extern float endstop_adj[ABC]; // axis[n].endstop_adj
308 308
   extern float delta_radius;
309 309
   extern float delta_diagonal_rod;
310 310
   extern float delta_segments_per_second;
311 311
   extern float delta_diagonal_rod_trim_tower_1;
312 312
   extern float delta_diagonal_rod_trim_tower_2;
313 313
   extern float delta_diagonal_rod_trim_tower_3;
314
-  void inverse_kinematics(const float cartesian[3]);
314
+  void inverse_kinematics(const float cartesian[XYZ]);
315 315
   void recalc_delta_settings(float radius, float diagonal_rod);
316 316
   #if ENABLED(AUTO_BED_LEVELING_FEATURE)
317 317
     extern int delta_grid_spacing[2];
318
-    void adjust_delta(float cartesian[3]);
318
+    void adjust_delta(float cartesian[XYZ]);
319 319
   #endif
320 320
 #elif ENABLED(SCARA)
321
-  extern float delta[3];
322
-  extern float axis_scaling[3];  // Build size scaling
323
-  void inverse_kinematics(const float cartesian[3]);
324
-  void forward_kinematics_SCARA(float f_scara[3]);
321
+  extern float delta[ABC];
322
+  extern float axis_scaling[ABC];  // Build size scaling
323
+  void inverse_kinematics(const float cartesian[XYZ]);
324
+  void forward_kinematics_SCARA(float f_scara[ABC]);
325 325
 #endif
326 326
 
327 327
 #if ENABLED(Z_DUAL_ENDSTOPS)

+ 24
- 24
Marlin/Marlin_main.cpp 查看文件

@@ -286,8 +286,8 @@ uint8_t marlin_debug_flags = DEBUG_NONE;
286 286
 
287 287
 float current_position[NUM_AXIS] = { 0.0 };
288 288
 static float destination[NUM_AXIS] = { 0.0 };
289
-bool axis_known_position[3] = { false };
290
-bool axis_homed[3] = { false };
289
+bool axis_known_position[XYZ] = { false };
290
+bool axis_homed[XYZ] = { false };
291 291
 
292 292
 static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0;
293 293
 
@@ -327,11 +327,11 @@ float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DI
327 327
 float volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0);
328 328
 
329 329
 // The distance that XYZ has been offset by G92. Reset by G28.
330
-float position_shift[3] = { 0 };
330
+float position_shift[XYZ] = { 0 };
331 331
 
332 332
 // This offset is added to the configured home position.
333 333
 // Set by M206, M428, or menu item. Saved to EEPROM.
334
-float home_offset[3] = { 0 };
334
+float home_offset[XYZ] = { 0 };
335 335
 
336 336
 // Software Endstops are based on the configured limits.
337 337
 #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
@@ -462,11 +462,11 @@ static uint8_t target_extruder;
462 462
   #define TOWER_2 Y_AXIS
463 463
   #define TOWER_3 Z_AXIS
464 464
 
465
-  float delta[3];
466
-  float cartesian_position[3] = { 0 };
465
+  float delta[ABC];
466
+  float cartesian_position[XYZ] = { 0 };
467 467
   #define SIN_60 0.8660254037844386
468 468
   #define COS_60 0.5
469
-  float endstop_adj[3] = { 0 };
469
+  float endstop_adj[ABC] = { 0 };
470 470
   // these are the default values, can be overriden with M665
471 471
   float delta_radius = DELTA_RADIUS;
472 472
   float delta_tower1_x = -SIN_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_1); // front left tower
@@ -495,8 +495,8 @@ static uint8_t target_extruder;
495 495
 
496 496
 #if ENABLED(SCARA)
497 497
   float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND;
498
-  float delta[3];
499
-  float axis_scaling[3] = { 1, 1, 1 };    // Build size scaling, default to 1
498
+  float delta[ABC];
499
+  float axis_scaling[ABC] = { 1, 1, 1 };    // Build size scaling, default to 1
500 500
 #endif
501 501
 
502 502
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
@@ -1415,7 +1415,7 @@ DEFINE_PGM_READ_ANY(float,       float);
1415 1415
 DEFINE_PGM_READ_ANY(signed char, byte);
1416 1416
 
1417 1417
 #define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \
1418
-  static const PROGMEM type array##_P[3] =        \
1418
+  static const PROGMEM type array##_P[XYZ] =        \
1419 1419
       { X_##CONFIG, Y_##CONFIG, Z_##CONFIG };     \
1420 1420
   static inline type array(int axis)          \
1421 1421
   { return pgm_read_any(&array##_P[axis]); }
@@ -1555,7 +1555,7 @@ static void set_axis_is_at_home(AxisEnum axis) {
1555 1555
 
1556 1556
     if (axis == X_AXIS || axis == Y_AXIS) {
1557 1557
 
1558
-      float homeposition[3];
1558
+      float homeposition[XYZ];
1559 1559
       LOOP_XYZ(i) homeposition[i] = LOGICAL_POSITION(base_home_pos(i), i);
1560 1560
 
1561 1561
       // SERIAL_ECHOPGM("homeposition[x]= "); SERIAL_ECHO(homeposition[0]);
@@ -7802,9 +7802,9 @@ void ok_to_send() {
7802 7802
     delta_diagonal_rod_2_tower_3 = sq(diagonal_rod + delta_diagonal_rod_trim_tower_3);
7803 7803
   }
7804 7804
 
7805
-  void inverse_kinematics(const float in_cartesian[3]) {
7805
+  void inverse_kinematics(const float in_cartesian[XYZ]) {
7806 7806
 
7807
-    const float cartesian[3] = {
7807
+    const float cartesian[XYZ] = {
7808 7808
       RAW_X_POSITION(in_cartesian[X_AXIS]),
7809 7809
       RAW_Y_POSITION(in_cartesian[Y_AXIS]),
7810 7810
       RAW_Z_POSITION(in_cartesian[Z_AXIS])
@@ -7834,7 +7834,7 @@ void ok_to_send() {
7834 7834
   }
7835 7835
 
7836 7836
   float delta_safe_distance_from_top() {
7837
-    float cartesian[3] = {
7837
+    float cartesian[XYZ] = {
7838 7838
       LOGICAL_X_POSITION(0),
7839 7839
       LOGICAL_Y_POSITION(0),
7840 7840
       LOGICAL_Z_POSITION(0)
@@ -7915,20 +7915,20 @@ void ok_to_send() {
7915 7915
     cartesian_position[Z_AXIS] = z1             + ex[2]*Xnew + ey[2]*Ynew - ez[2]*Znew;
7916 7916
   };
7917 7917
 
7918
-  void forward_kinematics_DELTA(float point[3]) {
7919
-    forward_kinematics_DELTA(point[X_AXIS], point[Y_AXIS], point[Z_AXIS]);
7918
+  void forward_kinematics_DELTA(float point[ABC]) {
7919
+    forward_kinematics_DELTA(point[A_AXIS], point[B_AXIS], point[C_AXIS]);
7920 7920
   }
7921 7921
 
7922 7922
   void set_cartesian_from_steppers() {
7923
-    forward_kinematics_DELTA(stepper.get_axis_position_mm(X_AXIS),
7924
-                             stepper.get_axis_position_mm(Y_AXIS),
7925
-                             stepper.get_axis_position_mm(Z_AXIS));
7923
+    forward_kinematics_DELTA(stepper.get_axis_position_mm(A_AXIS),
7924
+                             stepper.get_axis_position_mm(B_AXIS),
7925
+                             stepper.get_axis_position_mm(C_AXIS));
7926 7926
   }
7927 7927
 
7928 7928
   #if ENABLED(AUTO_BED_LEVELING_FEATURE)
7929 7929
 
7930 7930
     // Adjust print surface height by linear interpolation over the bed_level array.
7931
-    void adjust_delta(float cartesian[3]) {
7931
+    void adjust_delta(float cartesian[XYZ]) {
7932 7932
       if (delta_grid_spacing[X_AXIS] == 0 || delta_grid_spacing[Y_AXIS] == 0) return; // G29 not done!
7933 7933
 
7934 7934
       int half = (AUTO_BED_LEVELING_GRID_POINTS - 1) / 2;
@@ -8401,8 +8401,8 @@ void prepare_move_to_destination() {
8401 8401
 
8402 8402
 #if ENABLED(SCARA)
8403 8403
 
8404
-  void forward_kinematics_SCARA(float f_scara[3]) {
8405
-    // Perform forward kinematics, and place results in delta[3]
8404
+  void forward_kinematics_SCARA(float f_scara[ABC]) {
8405
+    // Perform forward kinematics, and place results in delta[]
8406 8406
     // The maths and first version has been done by QHARLEY . Integrated into masterbranch 06/2014 and slightly restructured by Joachim Cerny in June 2014
8407 8407
 
8408 8408
     float x_sin, x_cos, y_sin, y_cos;
@@ -8427,9 +8427,9 @@ void prepare_move_to_destination() {
8427 8427
     //SERIAL_ECHOPGM(" delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]);
8428 8428
   }
8429 8429
 
8430
-  void inverse_kinematics(const float cartesian[3]) {
8430
+  void inverse_kinematics(const float cartesian[XYZ]) {
8431 8431
     // Inverse kinematics.
8432
-    // Perform SCARA IK and place results in delta[3].
8432
+    // Perform SCARA IK and place results in delta[].
8433 8433
     // The maths and first version were done by QHARLEY.
8434 8434
     // Integrated, tweaked by Joachim Cerny in June 2014.
8435 8435
 

+ 1
- 1
Marlin/planner.cpp 查看文件

@@ -968,7 +968,7 @@ void Planner::check_axes_activity() {
968 968
     float junction_deviation = 0.1;
969 969
 
970 970
     // Compute path unit vector
971
-    double unit_vec[3];
971
+    double unit_vec[XYZ];
972 972
 
973 973
     unit_vec[X_AXIS] = delta_mm[X_AXIS] * inverse_millimeters;
974 974
     unit_vec[Y_AXIS] = delta_mm[Y_AXIS] * inverse_millimeters;

+ 1
- 1
Marlin/stepper.cpp 查看文件

@@ -122,7 +122,7 @@ unsigned short Stepper::acc_step_rate; // needed for deceleration start point
122 122
 uint8_t Stepper::step_loops, Stepper::step_loops_nominal;
123 123
 unsigned short Stepper::OCR1A_nominal;
124 124
 
125
-volatile long Stepper::endstops_trigsteps[3];
125
+volatile long Stepper::endstops_trigsteps[XYZ];
126 126
 
127 127
 #if ENABLED(X_DUAL_STEPPER_DRIVERS)
128 128
   #define X_APPLY_DIR(v,Q) do{ X_DIR_WRITE(v); X2_DIR_WRITE((v) != INVERT_X2_VS_X_DIR); }while(0)

+ 1
- 1
Marlin/stepper.h 查看文件

@@ -128,7 +128,7 @@ class Stepper {
128 128
     static uint8_t step_loops, step_loops_nominal;
129 129
     static unsigned short OCR1A_nominal;
130 130
 
131
-    static volatile long endstops_trigsteps[3];
131
+    static volatile long endstops_trigsteps[XYZ];
132 132
     static volatile long endstops_stepsTotal, endstops_stepsDone;
133 133
 
134 134
     #if HAS_MOTOR_CURRENT_PWM

+ 1
- 1
Marlin/temperature.cpp 查看文件

@@ -95,7 +95,7 @@ unsigned char Temperature::soft_pwm_bed;
95 95
 #endif
96 96
 
97 97
 #if ENABLED(BABYSTEPPING)
98
-  volatile int Temperature::babystepsTodo[3] = { 0 };
98
+  volatile int Temperature::babystepsTodo[XYZ] = { 0 };
99 99
 #endif
100 100
 
101 101
 #if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0

正在加载...
取消
保存