Browse Source

General DELTA_IK macro

Scott Lahteine 6 years ago
parent
commit
caa5093498

+ 1
- 1
Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp View File

427
 
427
 
428
     #if ENABLED(DELTA)  // apply delta inverse_kinematics
428
     #if ENABLED(DELTA)  // apply delta inverse_kinematics
429
 
429
 
430
-      DELTA_RAW_IK();
430
+      DELTA_IK(raw);
431
       planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], in_raw[E_AXIS], fr, active_extruder);
431
       planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], in_raw[E_AXIS], fr, active_extruder);
432
 
432
 
433
     #elif IS_SCARA  // apply scara inverse_kinematics (should be changed to save raw->logical->raw)
433
     #elif IS_SCARA  // apply scara inverse_kinematics (should be changed to save raw->logical->raw)

+ 1
- 1
Marlin/src/module/delta.cpp View File

121
   }while(0)
121
   }while(0)
122
 
122
 
123
 void inverse_kinematics(const float raw[XYZ]) {
123
 void inverse_kinematics(const float raw[XYZ]) {
124
-  DELTA_RAW_IK();
124
+  DELTA_IK(raw);
125
   // DELTA_DEBUG();
125
   // DELTA_DEBUG();
126
 }
126
 }
127
 
127
 

+ 9
- 9
Marlin/src/module/delta.h View File

76
 #endif
76
 #endif
77
 
77
 
78
 // Macro to obtain the Z position of an individual tower
78
 // Macro to obtain the Z position of an individual tower
79
-#define DELTA_Z(T) raw[Z_AXIS] + _SQRT(     \
80
-  delta_diagonal_rod_2_tower[T] - HYPOT2(   \
81
-      delta_tower[T][X_AXIS] - raw[X_AXIS], \
82
-      delta_tower[T][Y_AXIS] - raw[Y_AXIS]  \
83
-    )                                       \
79
+#define DELTA_Z(V,T) V[Z_AXIS] + _SQRT(   \
80
+  delta_diagonal_rod_2_tower[T] - HYPOT2( \
81
+      delta_tower[T][X_AXIS] - V[X_AXIS], \
82
+      delta_tower[T][Y_AXIS] - V[Y_AXIS]  \
83
+    )                                     \
84
   )
84
   )
85
 
85
 
86
-#define DELTA_RAW_IK() do {        \
87
-  delta[A_AXIS] = DELTA_Z(A_AXIS); \
88
-  delta[B_AXIS] = DELTA_Z(B_AXIS); \
89
-  delta[C_AXIS] = DELTA_Z(C_AXIS); \
86
+#define DELTA_IK(V) do {        \
87
+  delta[A_AXIS] = DELTA_Z(V, A_AXIS); \
88
+  delta[B_AXIS] = DELTA_Z(V, B_AXIS); \
89
+  delta[C_AXIS] = DELTA_Z(V, C_AXIS); \
90
 }while(0)
90
 }while(0)
91
 
91
 
92
 void inverse_kinematics(const float raw[XYZ]);
92
 void inverse_kinematics(const float raw[XYZ]);

+ 1
- 1
Marlin/src/module/motion.cpp View File

613
       LOOP_XYZE(i) raw[i] += segment_distance[i];
613
       LOOP_XYZE(i) raw[i] += segment_distance[i];
614
 
614
 
615
       #if ENABLED(DELTA)
615
       #if ENABLED(DELTA)
616
-        DELTA_RAW_IK(); // Delta can inline its kinematics
616
+        DELTA_IK(raw); // Delta can inline its kinematics
617
       #else
617
       #else
618
         inverse_kinematics(raw);
618
         inverse_kinematics(raw);
619
       #endif
619
       #endif

Loading…
Cancel
Save