Browse Source

Followup to 21e60fd

`ENABLED` only works for flag-type options. Floats must use `#ifdef`.
Scott Lahteine 7 years ago
parent
commit
304e0f8945

+ 18
- 20
Marlin/src/feature/bedlevel/ubl/ubl.h View File

224
           }
224
           }
225
         #endif
225
         #endif
226
 
226
 
227
-        /**
228
-         * The requested location is off the mesh.  Check if UBL_Z_RAISE_WHEN_OFF_MESH
229
-         * is specified. If so, that value is returned.
230
-         */
231
-        #if ENABLED(UBL_Z_RAISE_WHEN_OFF_MESH)
232
-          return UBL_Z_RAISE_WHEN_OFF_MESH;
233
-        #else
234
-          return NAN;
235
-        #endif
227
+        // The requested location is off the mesh. Return UBL_Z_RAISE_WHEN_OFF_MESH or NAN.
228
+        return (
229
+          #ifdef UBL_Z_RAISE_WHEN_OFF_MESH
230
+            UBL_Z_RAISE_WHEN_OFF_MESH
231
+          #else
232
+            NAN
233
+          #endif
234
+        );
236
       }
235
       }
237
 
236
 
238
       const float xratio = (rx0 - mesh_index_to_xpos(x1_i)) * (1.0 / (MESH_X_DIST)),
237
       const float xratio = (rx0 - mesh_index_to_xpos(x1_i)) * (1.0 / (MESH_X_DIST)),
259
           }
258
           }
260
         #endif
259
         #endif
261
 
260
 
262
-        /**
263
-         * The requested location is off the mesh.  Check if UBL_Z_RAISE_WHEN_OFF_MESH
264
-         * is specified. If so, that value is returned.
265
-         */
266
-        #if ENABLED(UBL_Z_RAISE_WHEN_OFF_MESH)
267
-          return UBL_Z_RAISE_WHEN_OFF_MESH;
268
-        #else
269
-          return NAN;
270
-        #endif
261
+        // The requested location is off the mesh. Return UBL_Z_RAISE_WHEN_OFF_MESH or NAN.
262
+        return (
263
+          #ifdef UBL_Z_RAISE_WHEN_OFF_MESH
264
+            UBL_Z_RAISE_WHEN_OFF_MESH
265
+          #else
266
+            NAN
267
+          #endif
268
+        );
271
       }
269
       }
272
 
270
 
273
       const float yratio = (ry0 - mesh_index_to_ypos(y1_i)) * (1.0 / (MESH_Y_DIST)),
271
       const float yratio = (ry0 - mesh_index_to_ypos(y1_i)) * (1.0 / (MESH_Y_DIST)),
292
        * Check if the requested location is off the mesh.  If so, and
290
        * Check if the requested location is off the mesh.  If so, and
293
        * UBL_Z_RAISE_WHEN_OFF_MESH is specified, that value is returned.
291
        * UBL_Z_RAISE_WHEN_OFF_MESH is specified, that value is returned.
294
        */
292
        */
295
-      #if ENABLED(UBL_Z_RAISE_WHEN_OFF_MESH)
293
+      #ifdef UBL_Z_RAISE_WHEN_OFF_MESH
296
         if (!WITHIN(rx0, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(ry0, 0, GRID_MAX_POINTS_Y - 1))
294
         if (!WITHIN(rx0, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(ry0, 0, GRID_MAX_POINTS_Y - 1))
297
-          return UBL_Z_RAISE_WHEN_OFF_MESHH;
295
+          return UBL_Z_RAISE_WHEN_OFF_MESH;
298
       #endif
296
       #endif
299
 
297
 
300
       const float z1 = calc_z0(rx0,
298
       const float z1 = calc_z0(rx0,

+ 6
- 6
Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp View File

86
       if (!WITHIN(cell_dest_xi, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(cell_dest_yi, 0, GRID_MAX_POINTS_Y - 1)) {
86
       if (!WITHIN(cell_dest_xi, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(cell_dest_yi, 0, GRID_MAX_POINTS_Y - 1)) {
87
 
87
 
88
         // Note: There is no Z Correction in this case. We are off the grid and don't know what
88
         // Note: There is no Z Correction in this case. We are off the grid and don't know what
89
-        // a reasonable correction would be.  If the user has specified a UBL_Z_RAISE_WHEN_OFF_MESH 
89
+        // a reasonable correction would be.  If the user has specified a UBL_Z_RAISE_WHEN_OFF_MESH
90
         // value, that will be used instead of a calculated (Bi-Linear interpolation) correction.
90
         // value, that will be used instead of a calculated (Bi-Linear interpolation) correction.
91
-
92
-        float z_raise = 0.0;
93
-        #if ENABLED(UBL_Z_RAISE_WHEN_OFF_MESH)
94
-          z_raise = UBL_Z_RAISE_WHEN_OFF_MESH;
95
-        #endif
91
+        const float z_raise = 0.0
92
+          #ifdef UBL_Z_RAISE_WHEN_OFF_MESH
93
+            + UBL_Z_RAISE_WHEN_OFF_MESH
94
+          #endif
95
+        ;
96
         planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + z_raise, end[E_AXIS], feed_rate, extruder);
96
         planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + z_raise, end[E_AXIS], feed_rate, extruder);
97
         set_current_from_destination();
97
         set_current_from_destination();
98
 
98
 

Loading…
Cancel
Save