소스 검색

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
 extern int flow_percentage[EXTRUDERS]; // Extrusion factor for each extruder
266
 extern int flow_percentage[EXTRUDERS]; // Extrusion factor for each extruder
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.
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
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
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
 extern volatile bool wait_for_heatup;
271
 extern volatile bool wait_for_heatup;
272
 
272
 
273
 extern float current_position[NUM_AXIS];
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
 // Software Endstops
277
 // Software Endstops
278
 void update_software_endstops(AxisEnum axis);
278
 void update_software_endstops(AxisEnum axis);
303
 float code_value_temp_diff();
303
 float code_value_temp_diff();
304
 
304
 
305
 #if ENABLED(DELTA)
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
   extern float delta_radius;
308
   extern float delta_radius;
309
   extern float delta_diagonal_rod;
309
   extern float delta_diagonal_rod;
310
   extern float delta_segments_per_second;
310
   extern float delta_segments_per_second;
311
   extern float delta_diagonal_rod_trim_tower_1;
311
   extern float delta_diagonal_rod_trim_tower_1;
312
   extern float delta_diagonal_rod_trim_tower_2;
312
   extern float delta_diagonal_rod_trim_tower_2;
313
   extern float delta_diagonal_rod_trim_tower_3;
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
   void recalc_delta_settings(float radius, float diagonal_rod);
315
   void recalc_delta_settings(float radius, float diagonal_rod);
316
   #if ENABLED(AUTO_BED_LEVELING_FEATURE)
316
   #if ENABLED(AUTO_BED_LEVELING_FEATURE)
317
     extern int delta_grid_spacing[2];
317
     extern int delta_grid_spacing[2];
318
-    void adjust_delta(float cartesian[3]);
318
+    void adjust_delta(float cartesian[XYZ]);
319
   #endif
319
   #endif
320
 #elif ENABLED(SCARA)
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
 #endif
325
 #endif
326
 
326
 
327
 #if ENABLED(Z_DUAL_ENDSTOPS)
327
 #if ENABLED(Z_DUAL_ENDSTOPS)

+ 24
- 24
Marlin/Marlin_main.cpp 파일 보기

286
 
286
 
287
 float current_position[NUM_AXIS] = { 0.0 };
287
 float current_position[NUM_AXIS] = { 0.0 };
288
 static float destination[NUM_AXIS] = { 0.0 };
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
 static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0;
292
 static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0;
293
 
293
 
327
 float volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0);
327
 float volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0);
328
 
328
 
329
 // The distance that XYZ has been offset by G92. Reset by G28.
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
 // This offset is added to the configured home position.
332
 // This offset is added to the configured home position.
333
 // Set by M206, M428, or menu item. Saved to EEPROM.
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
 // Software Endstops are based on the configured limits.
336
 // Software Endstops are based on the configured limits.
337
 #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
337
 #if ENABLED(min_software_endstops) || ENABLED(max_software_endstops)
462
   #define TOWER_2 Y_AXIS
462
   #define TOWER_2 Y_AXIS
463
   #define TOWER_3 Z_AXIS
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
   #define SIN_60 0.8660254037844386
467
   #define SIN_60 0.8660254037844386
468
   #define COS_60 0.5
468
   #define COS_60 0.5
469
-  float endstop_adj[3] = { 0 };
469
+  float endstop_adj[ABC] = { 0 };
470
   // these are the default values, can be overriden with M665
470
   // these are the default values, can be overriden with M665
471
   float delta_radius = DELTA_RADIUS;
471
   float delta_radius = DELTA_RADIUS;
472
   float delta_tower1_x = -SIN_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_1); // front left tower
472
   float delta_tower1_x = -SIN_60 * (delta_radius + DELTA_RADIUS_TRIM_TOWER_1); // front left tower
495
 
495
 
496
 #if ENABLED(SCARA)
496
 #if ENABLED(SCARA)
497
   float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND;
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
 #endif
500
 #endif
501
 
501
 
502
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
502
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
1415
 DEFINE_PGM_READ_ANY(signed char, byte);
1415
 DEFINE_PGM_READ_ANY(signed char, byte);
1416
 
1416
 
1417
 #define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \
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
       { X_##CONFIG, Y_##CONFIG, Z_##CONFIG };     \
1419
       { X_##CONFIG, Y_##CONFIG, Z_##CONFIG };     \
1420
   static inline type array(int axis)          \
1420
   static inline type array(int axis)          \
1421
   { return pgm_read_any(&array##_P[axis]); }
1421
   { return pgm_read_any(&array##_P[axis]); }
1555
 
1555
 
1556
     if (axis == X_AXIS || axis == Y_AXIS) {
1556
     if (axis == X_AXIS || axis == Y_AXIS) {
1557
 
1557
 
1558
-      float homeposition[3];
1558
+      float homeposition[XYZ];
1559
       LOOP_XYZ(i) homeposition[i] = LOGICAL_POSITION(base_home_pos(i), i);
1559
       LOOP_XYZ(i) homeposition[i] = LOGICAL_POSITION(base_home_pos(i), i);
1560
 
1560
 
1561
       // SERIAL_ECHOPGM("homeposition[x]= "); SERIAL_ECHO(homeposition[0]);
1561
       // SERIAL_ECHOPGM("homeposition[x]= "); SERIAL_ECHO(homeposition[0]);
7802
     delta_diagonal_rod_2_tower_3 = sq(diagonal_rod + delta_diagonal_rod_trim_tower_3);
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
       RAW_X_POSITION(in_cartesian[X_AXIS]),
7808
       RAW_X_POSITION(in_cartesian[X_AXIS]),
7809
       RAW_Y_POSITION(in_cartesian[Y_AXIS]),
7809
       RAW_Y_POSITION(in_cartesian[Y_AXIS]),
7810
       RAW_Z_POSITION(in_cartesian[Z_AXIS])
7810
       RAW_Z_POSITION(in_cartesian[Z_AXIS])
7834
   }
7834
   }
7835
 
7835
 
7836
   float delta_safe_distance_from_top() {
7836
   float delta_safe_distance_from_top() {
7837
-    float cartesian[3] = {
7837
+    float cartesian[XYZ] = {
7838
       LOGICAL_X_POSITION(0),
7838
       LOGICAL_X_POSITION(0),
7839
       LOGICAL_Y_POSITION(0),
7839
       LOGICAL_Y_POSITION(0),
7840
       LOGICAL_Z_POSITION(0)
7840
       LOGICAL_Z_POSITION(0)
7915
     cartesian_position[Z_AXIS] = z1             + ex[2]*Xnew + ey[2]*Ynew - ez[2]*Znew;
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
   void set_cartesian_from_steppers() {
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
   #if ENABLED(AUTO_BED_LEVELING_FEATURE)
7928
   #if ENABLED(AUTO_BED_LEVELING_FEATURE)
7929
 
7929
 
7930
     // Adjust print surface height by linear interpolation over the bed_level array.
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
       if (delta_grid_spacing[X_AXIS] == 0 || delta_grid_spacing[Y_AXIS] == 0) return; // G29 not done!
7932
       if (delta_grid_spacing[X_AXIS] == 0 || delta_grid_spacing[Y_AXIS] == 0) return; // G29 not done!
7933
 
7933
 
7934
       int half = (AUTO_BED_LEVELING_GRID_POINTS - 1) / 2;
7934
       int half = (AUTO_BED_LEVELING_GRID_POINTS - 1) / 2;
8401
 
8401
 
8402
 #if ENABLED(SCARA)
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
     // The maths and first version has been done by QHARLEY . Integrated into masterbranch 06/2014 and slightly restructured by Joachim Cerny in June 2014
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
     float x_sin, x_cos, y_sin, y_cos;
8408
     float x_sin, x_cos, y_sin, y_cos;
8427
     //SERIAL_ECHOPGM(" delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]);
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
     // Inverse kinematics.
8431
     // Inverse kinematics.
8432
-    // Perform SCARA IK and place results in delta[3].
8432
+    // Perform SCARA IK and place results in delta[].
8433
     // The maths and first version were done by QHARLEY.
8433
     // The maths and first version were done by QHARLEY.
8434
     // Integrated, tweaked by Joachim Cerny in June 2014.
8434
     // Integrated, tweaked by Joachim Cerny in June 2014.
8435
 
8435
 

+ 1
- 1
Marlin/planner.cpp 파일 보기

968
     float junction_deviation = 0.1;
968
     float junction_deviation = 0.1;
969
 
969
 
970
     // Compute path unit vector
970
     // Compute path unit vector
971
-    double unit_vec[3];
971
+    double unit_vec[XYZ];
972
 
972
 
973
     unit_vec[X_AXIS] = delta_mm[X_AXIS] * inverse_millimeters;
973
     unit_vec[X_AXIS] = delta_mm[X_AXIS] * inverse_millimeters;
974
     unit_vec[Y_AXIS] = delta_mm[Y_AXIS] * inverse_millimeters;
974
     unit_vec[Y_AXIS] = delta_mm[Y_AXIS] * inverse_millimeters;

+ 1
- 1
Marlin/stepper.cpp 파일 보기

122
 uint8_t Stepper::step_loops, Stepper::step_loops_nominal;
122
 uint8_t Stepper::step_loops, Stepper::step_loops_nominal;
123
 unsigned short Stepper::OCR1A_nominal;
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
 #if ENABLED(X_DUAL_STEPPER_DRIVERS)
127
 #if ENABLED(X_DUAL_STEPPER_DRIVERS)
128
   #define X_APPLY_DIR(v,Q) do{ X_DIR_WRITE(v); X2_DIR_WRITE((v) != INVERT_X2_VS_X_DIR); }while(0)
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
     static uint8_t step_loops, step_loops_nominal;
128
     static uint8_t step_loops, step_loops_nominal;
129
     static unsigned short OCR1A_nominal;
129
     static unsigned short OCR1A_nominal;
130
 
130
 
131
-    static volatile long endstops_trigsteps[3];
131
+    static volatile long endstops_trigsteps[XYZ];
132
     static volatile long endstops_stepsTotal, endstops_stepsDone;
132
     static volatile long endstops_stepsTotal, endstops_stepsDone;
133
 
133
 
134
     #if HAS_MOTOR_CURRENT_PWM
134
     #if HAS_MOTOR_CURRENT_PWM

+ 1
- 1
Marlin/temperature.cpp 파일 보기

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

Loading…
취소
저장