1 #include "CartesianSolution.h"
4 CartesianSolution::CartesianSolution(Config
* passed_config
) : config(passed_config
){
5 this->alpha_steps_per_mm
= this->config
->value(alpha_steps_per_mm_checksum
)->as_number();
6 this->beta_steps_per_mm
= this->config
->value( beta_steps_per_mm_checksum
)->as_number();
7 this->gamma_steps_per_mm
= this->config
->value(gamma_steps_per_mm_checksum
)->as_number();
10 void CartesianSolution::millimeters_to_steps( double millimeters
[], int steps
[] ){
11 steps
[ALPHA_STEPPER
] = lround( millimeters
[X_AXIS
] * this->alpha_steps_per_mm
);
12 steps
[BETA_STEPPER
] = lround( millimeters
[Y_AXIS
] * this->beta_steps_per_mm
);
13 steps
[GAMMA_STEPPER
] = lround( millimeters
[Z_AXIS
] * this->gamma_steps_per_mm
);
16 void CartesianSolution::steps_to_millimeters( int steps
[], double millimeters
[] ){
17 millimeters
[ALPHA_STEPPER
] = steps
[X_AXIS
] / this->alpha_steps_per_mm
;
18 millimeters
[BETA_STEPPER
] = steps
[Y_AXIS
] / this->beta_steps_per_mm
;
19 millimeters
[GAMMA_STEPPER
] = steps
[Z_AXIS
] / this->gamma_steps_per_mm
;
22 void CartesianSolution::set_steps_per_millimeter( double steps
[] )
24 this->alpha_steps_per_mm
= steps
[0];
25 this->beta_steps_per_mm
= steps
[1];
26 this->gamma_steps_per_mm
= steps
[2];
29 void CartesianSolution::get_steps_per_millimeter( double steps
[] )
31 steps
[0] = this->alpha_steps_per_mm
;
32 steps
[1] = this->beta_steps_per_mm
;
33 steps
[2] = this->gamma_steps_per_mm
;