General DELTA_IK macro

This commit is contained in:
Scott Lahteine 2017-12-21 22:41:57 -06:00
parent c694608450
commit caa5093498
4 changed files with 12 additions and 12 deletions

View file

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

View file

@ -121,7 +121,7 @@ void recalc_delta_settings() {
}while(0)
void inverse_kinematics(const float raw[XYZ]) {
DELTA_RAW_IK();
DELTA_IK(raw);
// DELTA_DEBUG();
}

View file

@ -76,17 +76,17 @@ void recalc_delta_settings();
#endif
// Macro to obtain the Z position of an individual tower
#define DELTA_Z(T) raw[Z_AXIS] + _SQRT( \
delta_diagonal_rod_2_tower[T] - HYPOT2( \
delta_tower[T][X_AXIS] - raw[X_AXIS], \
delta_tower[T][Y_AXIS] - raw[Y_AXIS] \
) \
#define DELTA_Z(V,T) V[Z_AXIS] + _SQRT( \
delta_diagonal_rod_2_tower[T] - HYPOT2( \
delta_tower[T][X_AXIS] - V[X_AXIS], \
delta_tower[T][Y_AXIS] - V[Y_AXIS] \
) \
)
#define DELTA_RAW_IK() do { \
delta[A_AXIS] = DELTA_Z(A_AXIS); \
delta[B_AXIS] = DELTA_Z(B_AXIS); \
delta[C_AXIS] = DELTA_Z(C_AXIS); \
#define DELTA_IK(V) do { \
delta[A_AXIS] = DELTA_Z(V, A_AXIS); \
delta[B_AXIS] = DELTA_Z(V, B_AXIS); \
delta[C_AXIS] = DELTA_Z(V, C_AXIS); \
}while(0)
void inverse_kinematics(const float raw[XYZ]);

View file

@ -613,7 +613,7 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
LOOP_XYZE(i) raw[i] += segment_distance[i];
#if ENABLED(DELTA)
DELTA_RAW_IK(); // Delta can inline its kinematics
DELTA_IK(raw); // Delta can inline its kinematics
#else
inverse_kinematics(raw);
#endif