Pre-calculate diagonal rod length squared

This commit is contained in:
Nicolas Rossi 2013-07-30 14:09:21 +02:00
parent 4623e78ce0
commit 9bf1cf1b22
2 changed files with 6 additions and 3 deletions

View file

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

View file

@ -2254,15 +2254,15 @@ void clamp_to_software_endstops(float target[3])
#ifdef DELTA
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_Y-cartesian[Y_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_Y-cartesian[Y_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_Y-cartesian[Y_AXIS])
) + cartesian[Z_AXIS];