Apply const float & more

This commit is contained in:
Scott Lahteine 2017-05-22 13:55:07 -05:00
parent ad5638f78c
commit c99bd69889
3 changed files with 11 additions and 11 deletions

View file

@ -2355,7 +2355,7 @@ static void clean_up_after_endstop_or_probe_move() {
* - Raise to the BETWEEN height
* - Return the probed Z position
*/
float probe_pt(const float x, const float y, const bool stow/*=true*/, const int verbose_level/*=1*/) {
float probe_pt(const float &x, const float &y, const bool stow/*=true*/, const int verbose_level/*=1*/) {
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR(">>> probe_pt(", x);

View file

@ -52,7 +52,7 @@ void inline incremental_LSF_reset(struct linear_fit_data *lsf) {
memset(lsf, 0, sizeof(linear_fit_data));
}
void inline incremental_WLSF(struct linear_fit_data *lsf, float x, float y, float z, float w) {
void inline incremental_WLSF(struct linear_fit_data *lsf, const float &x, const float &y, const float &z, const float &w) {
// weight each accumulator by factor w, including the "number" of samples
// (analagous to calling inc_LSF twice with same values to weight it by 2X)
lsf->xbar += w * x;
@ -65,11 +65,11 @@ void inline incremental_WLSF(struct linear_fit_data *lsf, float x, float y, floa
lsf->xzbar += w * x * z;
lsf->yzbar += w * y * z;
lsf->N += w;
lsf->max_absx = max(fabs( w * x ), lsf->max_absx);
lsf->max_absy = max(fabs( w * y ), lsf->max_absy);
lsf->max_absx = max(fabs(w * x), lsf->max_absx);
lsf->max_absy = max(fabs(w * y), lsf->max_absy);
}
void inline incremental_LSF(struct linear_fit_data *lsf, float x, float y, float z) {
void inline incremental_LSF(struct linear_fit_data *lsf, const float &x, const float &y, const float &z) {
lsf->xbar += x;
lsf->ybar += y;
lsf->zbar += z;

View file

@ -51,10 +51,10 @@
extern uint8_t code_value_byte();
extern bool code_value_bool();
extern bool code_has_value();
extern float probe_pt(float x, float y, bool, int);
extern float probe_pt(const float &x, const float &y, bool, int);
extern bool set_probe_deployed(bool);
void smart_fill_mesh();
void smart_fill_wlsf(float);
void smart_fill_wlsf(const float &);
float measure_business_card_thickness(float &in_height);
void manually_probe_remaining_mesh(const float&, const float&, const float&, const float&, const bool);
@ -531,7 +531,7 @@
}
} else {
const float cvf = code_value_float();
switch( (int)truncf( cvf * 10.0 ) - 30 ) { // 3.1 -> 1
switch((int)truncf(cvf * 10.0) - 30) { // 3.1 -> 1
#if ENABLED(UBL_G29_P31)
case 1: {
@ -541,9 +541,9 @@
// P3.12 100X distance weighting
// P3.13 1000X distance weighting, approaches simple average of nearest points
const float weight_power = (cvf - 3.10) * 100.0; // 3.12345 -> 2.345
const float weight_factor = weight_power ? pow( 10.0, weight_power ) : 0;
smart_fill_wlsf( weight_factor );
const float weight_power = (cvf - 3.10) * 100.0, // 3.12345 -> 2.345
weight_factor = weight_power ? pow(10.0, weight_power) : 0;
smart_fill_wlsf(weight_factor);
}
break;
#endif