Pre-calculate diagonal rod length squared

2.0.x
Nicolas Rossi 12 years ago
parent 4623e78ce0
commit 9bf1cf1b22

@ -107,6 +107,9 @@
#define DELTA_TOWER3_X 0.0 // back middle tower #define DELTA_TOWER3_X 0.0 // back middle tower
#define DELTA_TOWER3_Y DELTA_RADIUS #define DELTA_TOWER3_Y DELTA_RADIUS
// Diagonal rod squared
#define DELTA_DIAGONAL_ROD_2 pow(DELTA_DIAGONAL_ROD,2)
//=========================================================================== //===========================================================================
//=============================Thermal Settings ============================ //=============================Thermal Settings ============================
//=========================================================================== //===========================================================================

@ -2254,15 +2254,15 @@ void clamp_to_software_endstops(float target[3])
#ifdef DELTA #ifdef DELTA
void calculate_delta(float cartesian[3]) void calculate_delta(float cartesian[3])
{ {
delta[X_AXIS] = sqrt(sq(DELTA_DIAGONAL_ROD) delta[X_AXIS] = sqrt(DELTA_DIAGONAL_ROD_2
- sq(DELTA_TOWER1_X-cartesian[X_AXIS]) - sq(DELTA_TOWER1_X-cartesian[X_AXIS])
- sq(DELTA_TOWER1_Y-cartesian[Y_AXIS]) - sq(DELTA_TOWER1_Y-cartesian[Y_AXIS])
) + cartesian[Z_AXIS]; ) + cartesian[Z_AXIS];
delta[Y_AXIS] = sqrt(sq(DELTA_DIAGONAL_ROD) delta[Y_AXIS] = sqrt(DELTA_DIAGONAL_ROD_2
- sq(DELTA_TOWER2_X-cartesian[X_AXIS]) - sq(DELTA_TOWER2_X-cartesian[X_AXIS])
- sq(DELTA_TOWER2_Y-cartesian[Y_AXIS]) - sq(DELTA_TOWER2_Y-cartesian[Y_AXIS])
) + cartesian[Z_AXIS]; ) + cartesian[Z_AXIS];
delta[Z_AXIS] = sqrt(sq(DELTA_DIAGONAL_ROD) delta[Z_AXIS] = sqrt(DELTA_DIAGONAL_ROD_2
- sq(DELTA_TOWER3_X-cartesian[X_AXIS]) - sq(DELTA_TOWER3_X-cartesian[X_AXIS])
- sq(DELTA_TOWER3_Y-cartesian[Y_AXIS]) - sq(DELTA_TOWER3_Y-cartesian[Y_AXIS])
) + cartesian[Z_AXIS]; ) + cartesian[Z_AXIS];

Loading…
Cancel
Save