Browse Source

Pre-calculate diagonal rod length squared

pull/1/head
Nicolas Rossi 11 years ago
parent
commit
9bf1cf1b22
  1. 3
      Marlin/Configuration.h
  2. 6
      Marlin/Marlin_main.cpp

3
Marlin/Configuration.h

@ -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 ============================
//=========================================================================== //===========================================================================

6
Marlin/Marlin_main.cpp

@ -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