Apply const float & more

master
Scott Lahteine 8 years ago
parent ad5638f78c
commit c99bd69889

@ -2355,7 +2355,7 @@ static void clean_up_after_endstop_or_probe_move() {
* - Raise to the BETWEEN height * - Raise to the BETWEEN height
* - Return the probed Z position * - 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 ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR(">>> probe_pt(", x); SERIAL_ECHOPAIR(">>> probe_pt(", x);

@ -52,7 +52,7 @@ void inline incremental_LSF_reset(struct linear_fit_data *lsf) {
memset(lsf, 0, sizeof(linear_fit_data)); 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 // 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) // (analagous to calling inc_LSF twice with same values to weight it by 2X)
lsf->xbar += w * x; 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->xzbar += w * x * z;
lsf->yzbar += w * y * z; lsf->yzbar += w * y * z;
lsf->N += w; lsf->N += w;
lsf->max_absx = max(fabs( w * x ), lsf->max_absx); lsf->max_absx = max(fabs(w * x), lsf->max_absx);
lsf->max_absy = max(fabs( w * y ), lsf->max_absy); 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->xbar += x;
lsf->ybar += y; lsf->ybar += y;
lsf->zbar += z; lsf->zbar += z;

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

Loading…
Cancel
Save