Browse Source

Clean up whitespace, trailing space, bad tab conversion, etc.

Scott Lahteine 7 years ago
parent
commit
622048ffb0
3 changed files with 10 additions and 25 deletions
  1. 1
    1
      .travis.yml
  2. 4
    10
      Marlin/ubl.h
  3. 5
    14
      Marlin/ubl_motion.cpp

+ 1
- 1
.travis.yml View File

@@ -1,5 +1,5 @@
1 1
 dist: trusty
2
-sudo: true 
2
+sudo: true
3 3
   #
4 4
 language: c
5 5
   #

+ 4
- 10
Marlin/ubl.h View File

@@ -384,18 +384,12 @@
384 384
         FORCE_INLINE static float fade_scaling_factor_for_z(const float &lz) { return 1.0; }
385 385
       #endif
386 386
 
387
-      FORCE_INLINE static float mesh_index_to_xpos(const uint8_t i) { 
388
-        if (i<GRID_MAX_POINTS_X) 
389
-          return pgm_read_float(&_mesh_index_to_xpos[i]); 
390
-        else  
391
-          return UBL_MESH_MIN_X + i * (MESH_X_DIST);
387
+      FORCE_INLINE static float mesh_index_to_xpos(const uint8_t i) {
388
+        return i < GRID_MAX_POINTS_X ? pgm_read_float(&_mesh_index_to_xpos[i]) : UBL_MESH_MIN_X + i * (MESH_X_DIST);
392 389
       }
393 390
 
394
-      FORCE_INLINE static float mesh_index_to_ypos(const uint8_t i) { 
395
-        if (i<GRID_MAX_POINTS_Y) 
396
-          return pgm_read_float(&_mesh_index_to_ypos[i]); 
397
-        else  
398
-          return UBL_MESH_MIN_Y + i * (MESH_Y_DIST);
391
+      FORCE_INLINE static float mesh_index_to_ypos(const uint8_t i) {
392
+        return i < GRID_MAX_POINTS_Y ? pgm_read_float(&_mesh_index_to_ypos[i]) : UBL_MESH_MIN_Y + i * (MESH_Y_DIST);
399 393
       }
400 394
 
401 395
       static bool prepare_segmented_line_to(const float ltarget[XYZE], const float &feedrate);

+ 5
- 14
Marlin/ubl_motion.cpp View File

@@ -176,26 +176,17 @@
176 176
       const float xratio = (RAW_X_POSITION(end[X_AXIS]) - mesh_index_to_xpos(cell_dest_xi)) * (1.0 / (MESH_X_DIST));
177 177
 
178 178
       float z1 = z_values[cell_dest_xi    ][cell_dest_yi    ] + xratio *
179
-                      (z_values[cell_dest_xi + 1][cell_dest_yi    ] - z_values[cell_dest_xi][cell_dest_yi    ]),
180
-                  z2 = z_values[cell_dest_xi    ][cell_dest_yi + 1] + xratio *
181
-                      (z_values[cell_dest_xi + 1][cell_dest_yi + 1] - z_values[cell_dest_xi][cell_dest_yi + 1]);
179
+                (z_values[cell_dest_xi + 1][cell_dest_yi    ] - z_values[cell_dest_xi][cell_dest_yi    ]),
180
+            z2 = z_values[cell_dest_xi    ][cell_dest_yi + 1] + xratio *
181
+                (z_values[cell_dest_xi + 1][cell_dest_yi + 1] - z_values[cell_dest_xi][cell_dest_yi + 1]);
182 182
 
183
-      if ( cell_dest_xi >= GRID_MAX_POINTS_X-1) {
184
-        z1 = 0.0;
185
-        z2 = 0.0;
186
-      }
183
+      if (cell_dest_xi >= GRID_MAX_POINTS_X - 1) z1 = z2 = 0.0;
187 184
 
188 185
       // we are done with the fractional X distance into the cell. Now with the two Z-Heights we have calculated, we
189 186
       // are going to apply the Y-Distance into the cell to interpolate the final Z correction.
190 187
 
191 188
       const float yratio = (RAW_Y_POSITION(end[Y_AXIS]) - mesh_index_to_ypos(cell_dest_yi)) * (1.0 / (MESH_Y_DIST));
192
-
193
-      float z0 = z1 + (z2 - z1) * yratio;
194
-
195
-      if ( cell_dest_yi >= GRID_MAX_POINTS_Y-1) 
196
-        z0 = 0.0;
197
-
198
-      z0 *= fade_scaling_factor_for_z(end[Z_AXIS]);
189
+      float z0 = cell_dest_yi < GRID_MAX_POINTS_Y - 1 ? z1 + (z2 - z1) * yratio * fade_scaling_factor_for_z(end[Z_AXIS]) : 0.0;
199 190
 
200 191
       /**
201 192
        * If part of the Mesh is undefined, it will show up as NAN

Loading…
Cancel
Save