Browse Source

Apply const float & more

Scott Lahteine 7 years ago
parent
commit
c99bd69889
3 changed files with 11 additions and 11 deletions
  1. 1
    1
      Marlin/Marlin_main.cpp
  2. 4
    4
      Marlin/least_squares_fit.h
  3. 6
    6
      Marlin/ubl_G29.cpp

+ 1
- 1
Marlin/Marlin_main.cpp View File

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

+ 4
- 4
Marlin/least_squares_fit.h View File

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

+ 6
- 6
Marlin/ubl_G29.cpp View File

@@ -51,10 +51,10 @@
51 51
   extern uint8_t code_value_byte();
52 52
   extern bool code_value_bool();
53 53
   extern bool code_has_value();
54
-  extern float probe_pt(float x, float y, bool, int);
54
+  extern float probe_pt(const float &x, const float &y, bool, int);
55 55
   extern bool set_probe_deployed(bool);
56 56
   void smart_fill_mesh();
57
-  void smart_fill_wlsf(float);
57
+  void smart_fill_wlsf(const float &);
58 58
   float measure_business_card_thickness(float &in_height);
59 59
   void manually_probe_remaining_mesh(const float&, const float&, const float&, const float&, const bool);
60 60
 
@@ -531,7 +531,7 @@
531 531
             }
532 532
           } else {
533 533
             const float cvf = code_value_float();
534
-            switch( (int)truncf( cvf * 10.0 ) - 30 ) {   // 3.1 -> 1
534
+            switch((int)truncf(cvf * 10.0) - 30) {   // 3.1 -> 1
535 535
               #if ENABLED(UBL_G29_P31)
536 536
                 case 1: {
537 537
 
@@ -541,9 +541,9 @@
541 541
                   // P3.12 100X distance weighting
542 542
                   // P3.13 1000X distance weighting, approaches simple average of nearest points
543 543
 
544
-                  const float weight_power  = (cvf - 3.10) * 100.0;  // 3.12345 -> 2.345
545
-                  const float weight_factor = weight_power ? pow( 10.0, weight_power ) : 0;
546
-                  smart_fill_wlsf( weight_factor );
544
+                  const float weight_power  = (cvf - 3.10) * 100.0,  // 3.12345 -> 2.345
545
+                              weight_factor = weight_power ? pow(10.0, weight_power) : 0;
546
+                  smart_fill_wlsf(weight_factor);
547 547
                 }
548 548
                 break;
549 549
               #endif

Loading…
Cancel
Save