Browse Source

Revert experimental NAN patch

Hold changes from #21575 (24a095c) for more testing.
Scott Lahteine 3 years ago
parent
commit
528b9bd872
31 changed files with 104 additions and 109 deletions
  1. 0
    3
      Marlin/src/core/macros.h
  2. 7
    7
      Marlin/src/feature/bedlevel/abl/abl.cpp
  3. 2
    2
      Marlin/src/feature/bedlevel/bedlevel.cpp
  4. 1
    3
      Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h
  5. 5
    5
      Marlin/src/feature/bedlevel/ubl/ubl.cpp
  6. 3
    3
      Marlin/src/feature/bedlevel/ubl/ubl.h
  7. 20
    20
      Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
  8. 9
    9
      Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp
  9. 1
    1
      Marlin/src/gcode/bedlevel/G35.cpp
  10. 11
    11
      Marlin/src/gcode/bedlevel/abl/G29.cpp
  11. 1
    1
      Marlin/src/gcode/bedlevel/ubl/M421.cpp
  12. 3
    3
      Marlin/src/gcode/calibrate/G33.cpp
  13. 1
    1
      Marlin/src/gcode/calibrate/G34_M422.cpp
  14. 3
    3
      Marlin/src/gcode/calibrate/G76_M192_M871.cpp
  15. 2
    2
      Marlin/src/gcode/calibrate/M48.cpp
  16. 1
    1
      Marlin/src/gcode/probe/G30.cpp
  17. 2
    2
      Marlin/src/lcd/HD44780/marlinui_HD44780.cpp
  18. 1
    1
      Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp
  19. 1
    1
      Marlin/src/lcd/dogm/marlinui_DOGM.cpp
  20. 1
    1
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/adjuster_widget.cpp
  21. 1
    1
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_base.cpp
  22. 1
    1
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_edit_screen.cpp
  23. 2
    2
      Marlin/src/lcd/extui/ui_api.cpp
  24. 1
    1
      Marlin/src/lcd/menu/menu_tramming.cpp
  25. 1
    1
      Marlin/src/lcd/tft/ui_1024x600.cpp
  26. 1
    1
      Marlin/src/lcd/tft/ui_320x240.cpp
  27. 1
    1
      Marlin/src/lcd/tft/ui_480x320.cpp
  28. 10
    10
      Marlin/src/module/probe.cpp
  29. 7
    7
      Marlin/src/module/settings.cpp
  30. 3
    3
      Marlin/src/module/temperature.h
  31. 1
    1
      platformio.ini

+ 0
- 3
Marlin/src/core/macros.h View File

@@ -112,9 +112,6 @@
112 112
 #define SIGN(a) ({__typeof__(a) _a = (a); (_a>0)-(_a<0);})
113 113
 #define IS_POWER_OF_2(x) ((x) && !((x) & ((x) - 1)))
114 114
 
115
-#define MFNAN 999999.0f
116
-#define ISNAN(V) ((V) == MFNAN)
117
-
118 115
 // Macros to constrain values
119 116
 #ifdef __cplusplus
120 117
 

+ 7
- 7
Marlin/src/feature/bedlevel/abl/abl.cpp View File

@@ -43,7 +43,7 @@ bed_mesh_t z_values;
43 43
  * Extrapolate a single point from its neighbors
44 44
  */
45 45
 static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir) {
46
-  if (!ISNAN(z_values[x][y])) return;
46
+  if (!isnan(z_values[x][y])) return;
47 47
   if (DEBUGGING(LEVELING)) {
48 48
     DEBUG_ECHOPGM("Extrapolate [");
49 49
     if (x < 10) DEBUG_CHAR(' ');
@@ -63,12 +63,12 @@ static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t
63 63
         c1 = z_values[x1][y1], c2 = z_values[x2][y2];
64 64
 
65 65
   // Treat far unprobed points as zero, near as equal to far
66
-  if (ISNAN(a2)) a2 = 0.0;
67
-  if (ISNAN(a1)) a1 = a2;
68
-  if (ISNAN(b2)) b2 = 0.0;
69
-  if (ISNAN(b1)) b1 = b2;
70
-  if (ISNAN(c2)) c2 = 0.0;
71
-  if (ISNAN(c1)) c1 = c2;
66
+  if (isnan(a2)) a2 = 0.0;
67
+  if (isnan(a1)) a1 = a2;
68
+  if (isnan(b2)) b2 = 0.0;
69
+  if (isnan(b1)) b1 = b2;
70
+  if (isnan(c2)) c2 = 0.0;
71
+  if (isnan(c1)) c1 = c2;
72 72
 
73 73
   const float a = 2 * a1 - a2, b = 2 * b1 - b2, c = 2 * c1 - c2;
74 74
 

+ 2
- 2
Marlin/src/feature/bedlevel/bedlevel.cpp View File

@@ -132,7 +132,7 @@ void reset_bed_level() {
132 132
       bilinear_start.reset();
133 133
       bilinear_grid_spacing.reset();
134 134
       GRID_LOOP(x, y) {
135
-        z_values[x][y] = MFNAN;
135
+        z_values[x][y] = NAN;
136 136
         TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, 0));
137 137
       }
138 138
     #elif ABL_PLANAR
@@ -177,7 +177,7 @@ void reset_bed_level() {
177 177
       LOOP_L_N(x, sx) {
178 178
         SERIAL_CHAR(' ');
179 179
         const float offset = fn(x, y);
180
-        if (!ISNAN(offset)) {
180
+        if (!isnan(offset)) {
181 181
           if (offset >= 0) SERIAL_CHAR('+');
182 182
           SERIAL_ECHO_F(offset, int(precision));
183 183
         }

+ 1
- 3
Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h View File

@@ -97,7 +97,6 @@ public:
97 97
   static inline xy_int8_t probe_indexes(const xy_pos_t &xy) { return probe_indexes(xy.x, xy.y); }
98 98
 
99 99
   static float calc_z0(const_float_t a0, const_float_t a1, const_float_t z1, const_float_t a2, const_float_t z2) {
100
-    if (ISNAN(a0) || ISNAN(a1) || ISNAN(z1) || ISNAN(a2) || ISNAN(z2)) return MFNAN;
101 100
     const float delta_z = (z2 - z1) / (a2 - a1),
102 101
                 delta_a = a0 - a1;
103 102
     return z1 + delta_a * delta_z;
@@ -118,8 +117,7 @@ public:
118 117
                 z2 = calc_z0(pos.x, x1, z_values[ind.x][ind.y+1], x2, z_values[ind.x+1][ind.y+1]),
119 118
                 zf = calc_z0(pos.y, y1, z1, y2, z2);
120 119
 
121
-
122
-    return ISNAN(zf) ? zf : z_offset + zf * factor;
120
+    return z_offset + zf * factor;
123 121
   }
124 122
 
125 123
   #if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)

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

@@ -48,7 +48,7 @@ void unified_bed_leveling::report_current_mesh() {
48 48
   if (!leveling_is_valid()) return;
49 49
   SERIAL_ECHO_MSG("  G29 I999");
50 50
   GRID_LOOP(x, y)
51
-    if (!ISNAN(z_values[x][y])) {
51
+    if (!isnan(z_values[x][y])) {
52 52
       SERIAL_ECHO_START();
53 53
       SERIAL_ECHOPAIR("  M421 I", x, " J", y);
54 54
       SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, z_values[x][y], 4);
@@ -99,7 +99,7 @@ void unified_bed_leveling::reset() {
99 99
 
100 100
 void unified_bed_leveling::invalidate() {
101 101
   set_bed_leveling_enabled(false);
102
-  set_all_mesh_points_to_value(MFNAN);
102
+  set_all_mesh_points_to_value(NAN);
103 103
 }
104 104
 
105 105
 void unified_bed_leveling::set_all_mesh_points_to_value(const_float_t value) {
@@ -116,7 +116,7 @@ void unified_bed_leveling::set_all_mesh_points_to_value(const_float_t value) {
116 116
 
117 117
   void unified_bed_leveling::set_store_from_mesh(const bed_mesh_t &in_values, mesh_store_t &stored_values) {
118 118
     auto z_to_store = [](const_float_t z) {
119
-      if (ISNAN(z)) return Z_STEPS_NAN;
119
+      if (isnan(z)) return Z_STEPS_NAN;
120 120
       const int32_t z_scaled = TRUNC(z * mesh_store_scaling);
121 121
       if (z_scaled == Z_STEPS_NAN || !WITHIN(z_scaled, INT16_MIN, INT16_MAX))
122 122
         return Z_STEPS_NAN; // If Z is out of range, return our custom 'NaN'
@@ -127,7 +127,7 @@ void unified_bed_leveling::set_all_mesh_points_to_value(const_float_t value) {
127 127
 
128 128
   void unified_bed_leveling::set_mesh_from_store(const mesh_store_t &stored_values, bed_mesh_t &out_values) {
129 129
     auto store_to_z = [](const int16_t z_scaled) {
130
-      return z_scaled == Z_STEPS_NAN ? MFNAN : z_scaled / mesh_store_scaling;
130
+      return z_scaled == Z_STEPS_NAN ? NAN : z_scaled / mesh_store_scaling;
131 131
     };
132 132
     GRID_LOOP(x, y) out_values[x][y] = store_to_z(stored_values[x][y]);
133 133
   }
@@ -211,7 +211,7 @@ void unified_bed_leveling::display_map(const int map_type) {
211 211
       if (lcd) {
212 212
         // TODO: Display on Graphical LCD
213 213
       }
214
-      else if (ISNAN(f))
214
+      else if (isnan(f))
215 215
         SERIAL_ECHOPGM_P(human ? PSTR("  .   ") : PSTR("NAN"));
216 216
       else if (human || csv) {
217 217
         if (human && f >= 0.0) SERIAL_CHAR(f > 0 ? '+' : ' ');  // Display sign also for positive numbers (' ' for 0)

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

@@ -196,7 +196,7 @@ public:
196 196
   #ifdef UBL_Z_RAISE_WHEN_OFF_MESH
197 197
     #define _UBL_OUTER_Z_RAISE UBL_Z_RAISE_WHEN_OFF_MESH
198 198
   #else
199
-    #define _UBL_OUTER_Z_RAISE MFNAN
199
+    #define _UBL_OUTER_Z_RAISE NAN
200 200
   #endif
201 201
 
202 202
   /**
@@ -269,7 +269,7 @@ public:
269 269
     const float z2 = calc_z0(rx0, mesh_index_to_xpos(cx), z_values[cx][my], mesh_index_to_xpos(cx + 1), z_values[mx][my]);
270 270
     float z0 = calc_z0(ry0, mesh_index_to_ypos(cy), z1, mesh_index_to_ypos(cy + 1), z2);
271 271
 
272
-    if (ISNAN(z0)) { // if part of the Mesh is undefined, it will show up as MFNAN
272
+    if (isnan(z0)) { // if part of the Mesh is undefined, it will show up as NAN
273 273
       z0 = 0.0;      // in ubl.z_values[][] and propagate through the
274 274
                      // calculations. If our correction is NAN, we throw it out
275 275
                      // because part of the Mesh is undefined and we don't have the
@@ -301,7 +301,7 @@ public:
301 301
   #endif
302 302
 
303 303
   static inline bool mesh_is_valid() {
304
-    GRID_LOOP(x, y) if (ISNAN(z_values[x][y])) return false;
304
+    GRID_LOOP(x, y) if (isnan(z_values[x][y])) return false;
305 305
     return true;
306 306
   }
307 307
 

+ 20
- 20
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp View File

@@ -331,7 +331,7 @@ void unified_bed_leveling::G29() {
331 331
         // to invalidate the ENTIRE mesh, which can't be done with
332 332
         // find_closest_mesh_point (which only returns REAL points).
333 333
         if (closest.pos.x < 0) { invalidate_all = true; break; }
334
-        z_values[closest.pos.x][closest.pos.y] = MFNAN;
334
+        z_values[closest.pos.x][closest.pos.y] = NAN;
335 335
         TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(closest.pos, 0.0f));
336 336
       }
337 337
     }
@@ -516,7 +516,7 @@ void unified_bed_leveling::G29() {
516 516
               if (cpos.x < 0) {
517 517
                 // No more REAL INVALID mesh points to populate, so we ASSUME
518 518
                 // user meant to populate ALL INVALID mesh points to value
519
-                GRID_LOOP(x, y) if (ISNAN(z_values[x][y])) z_values[x][y] = param.C_constant;
519
+                GRID_LOOP(x, y) if (isnan(z_values[x][y])) z_values[x][y] = param.C_constant;
520 520
                 break; // No more invalid Mesh Points to populate
521 521
               }
522 522
               else {
@@ -675,7 +675,7 @@ void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t o
675 675
   float sum = 0;
676 676
   int n = 0;
677 677
   GRID_LOOP(x, y)
678
-    if (!ISNAN(z_values[x][y])) {
678
+    if (!isnan(z_values[x][y])) {
679 679
       sum += z_values[x][y];
680 680
       n++;
681 681
     }
@@ -687,7 +687,7 @@ void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t o
687 687
   //
688 688
   float sum_of_diff_squared = 0;
689 689
   GRID_LOOP(x, y)
690
-    if (!ISNAN(z_values[x][y]))
690
+    if (!isnan(z_values[x][y]))
691 691
       sum_of_diff_squared += sq(z_values[x][y] - mean);
692 692
 
693 693
   SERIAL_ECHOLNPAIR("# of samples: ", n);
@@ -698,7 +698,7 @@ void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t o
698 698
 
699 699
   if (cflag)
700 700
     GRID_LOOP(x, y)
701
-      if (!ISNAN(z_values[x][y])) {
701
+      if (!isnan(z_values[x][y])) {
702 702
         z_values[x][y] -= mean + offset;
703 703
         TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
704 704
       }
@@ -709,7 +709,7 @@ void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t o
709 709
  */
710 710
 void unified_bed_leveling::shift_mesh_height() {
711 711
   GRID_LOOP(x, y)
712
-    if (!ISNAN(z_values[x][y])) {
712
+    if (!isnan(z_values[x][y])) {
713 713
       z_values[x][y] += param.C_constant;
714 714
       TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
715 715
     }
@@ -1017,7 +1017,7 @@ void set_message_with_feedback(PGM_P const msg_P) {
1017 1017
       ui.refresh();
1018 1018
 
1019 1019
       float new_z = z_values[lpos.x][lpos.y];
1020
-      if (ISNAN(new_z)) new_z = 0;                        // Invalid points begin at 0
1020
+      if (isnan(new_z)) new_z = 0;                        // Invalid points begin at 0
1021 1021
       new_z = FLOOR(new_z * 1000) * 0.001f;               // Chop off digits after the 1000ths place
1022 1022
 
1023 1023
       ui.ubl_mesh_edit_start(new_z);
@@ -1227,7 +1227,7 @@ mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {
1227 1227
   mesh_index_pair farthest { -1, -1, -99999.99 };
1228 1228
 
1229 1229
   GRID_LOOP(i, j) {
1230
-    if (!ISNAN(z_values[i][j])) continue;  // Skip valid mesh points
1230
+    if (!isnan(z_values[i][j])) continue;  // Skip valid mesh points
1231 1231
 
1232 1232
     // Skip unreachable points
1233 1233
     if (!probe.can_reach(mesh_index_to_xpos(i), mesh_index_to_ypos(j)))
@@ -1238,7 +1238,7 @@ mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {
1238 1238
     xy_int8_t nearby { -1, -1 };
1239 1239
     float d1, d2 = 99999.9f;
1240 1240
     GRID_LOOP(k, l) {
1241
-      if (ISNAN(z_values[k][l])) continue;
1241
+      if (isnan(z_values[k][l])) continue;
1242 1242
 
1243 1243
       found_a_real = true;
1244 1244
 
@@ -1282,7 +1282,7 @@ mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {
1282 1282
 
1283 1283
   static bool test_func(uint8_t i, uint8_t j, void *data) {
1284 1284
     find_closest_t *d = (find_closest_t*)data;
1285
-    if ( (d->type == (ISNAN(ubl.z_values[i][j]) ? INVALID : REAL))
1285
+    if ( (d->type == (isnan(ubl.z_values[i][j]) ? INVALID : REAL))
1286 1286
       || (d->type == SET_IN_BITMAP && !d->done_flags->marked(i, j))
1287 1287
     ) {
1288 1288
       // Found a Mesh Point of the specified type!
@@ -1326,7 +1326,7 @@ mesh_index_pair unified_bed_leveling::find_closest_mesh_point_of_type(const Mesh
1326 1326
     float best_so_far = 99999.99f;
1327 1327
 
1328 1328
     GRID_LOOP(i, j) {
1329
-      if ( (type == (ISNAN(z_values[i][j]) ? INVALID : REAL))
1329
+      if ( (type == (isnan(z_values[i][j]) ? INVALID : REAL))
1330 1330
         || (type == SET_IN_BITMAP && !done_flags->marked(i, j))
1331 1331
       ) {
1332 1332
         // Found a Mesh Point of the specified type!
@@ -1367,12 +1367,12 @@ mesh_index_pair unified_bed_leveling::find_closest_mesh_point_of_type(const Mesh
1367 1367
 
1368 1368
 bool unified_bed_leveling::smart_fill_one(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir) {
1369 1369
   const float v = z_values[x][y];
1370
-  if (ISNAN(v)) {                           // A NAN...
1370
+  if (isnan(v)) {                           // A NAN...
1371 1371
     const int8_t dx = x + xdir, dy = y + ydir;
1372 1372
     const float v1 = z_values[dx][dy];
1373
-    if (!ISNAN(v1)) {                       // ...next to a pair of real values?
1373
+    if (!isnan(v1)) {                       // ...next to a pair of real values?
1374 1374
       const float v2 = z_values[dx + xdir][dy + ydir];
1375
-      if (!ISNAN(v2)) {
1375
+      if (!isnan(v2)) {
1376 1376
         z_values[x][y] = v1 < v2 ? v1 : v1 + v1 - v2;
1377 1377
         TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
1378 1378
         return true;
@@ -1441,7 +1441,7 @@ void unified_bed_leveling::smart_fill_mesh() {
1441 1441
       TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " 1/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
1442 1442
 
1443 1443
       measured_z = probe.probe_at_point(points[0], PROBE_PT_RAISE, param.V_verbosity);
1444
-      if (ISNAN(measured_z))
1444
+      if (isnan(measured_z))
1445 1445
         abort_flag = true;
1446 1446
       else {
1447 1447
         measured_z -= get_z_correction(points[0]);
@@ -1463,7 +1463,7 @@ void unified_bed_leveling::smart_fill_mesh() {
1463 1463
         #ifdef VALIDATE_MESH_TILT
1464 1464
           z2 = measured_z;
1465 1465
         #endif
1466
-        if (ISNAN(measured_z))
1466
+        if (isnan(measured_z))
1467 1467
           abort_flag = true;
1468 1468
         else {
1469 1469
           measured_z -= get_z_correction(points[1]);
@@ -1483,7 +1483,7 @@ void unified_bed_leveling::smart_fill_mesh() {
1483 1483
         #ifdef VALIDATE_MESH_TILT
1484 1484
           z3 = measured_z;
1485 1485
         #endif
1486
-        if (ISNAN(measured_z))
1486
+        if (isnan(measured_z))
1487 1487
           abort_flag = true;
1488 1488
         else {
1489 1489
           measured_z -= get_z_correction(points[2]);
@@ -1522,7 +1522,7 @@ void unified_bed_leveling::smart_fill_mesh() {
1522 1522
 
1523 1523
             measured_z = probe.probe_at_point(rpos, parser.seen('E') ? PROBE_PT_STOW : PROBE_PT_RAISE, param.V_verbosity); // TODO: Needs error handling
1524 1524
 
1525
-            abort_flag = ISNAN(measured_z);
1525
+            abort_flag = isnan(measured_z);
1526 1526
 
1527 1527
             #if ENABLED(DEBUG_LEVELING_FEATURE)
1528 1528
               if (DEBUGGING(LEVELING)) {
@@ -1673,14 +1673,14 @@ void unified_bed_leveling::smart_fill_mesh() {
1673 1673
 
1674 1674
     const float weight_scaled = weight_factor * _MAX(MESH_X_DIST, MESH_Y_DIST);
1675 1675
 
1676
-    GRID_LOOP(jx, jy) if (!ISNAN(z_values[jx][jy])) SBI(bitmap[jx], jy);
1676
+    GRID_LOOP(jx, jy) if (!isnan(z_values[jx][jy])) SBI(bitmap[jx], jy);
1677 1677
 
1678 1678
     xy_pos_t ppos;
1679 1679
     LOOP_L_N(ix, GRID_MAX_POINTS_X) {
1680 1680
       ppos.x = mesh_index_to_xpos(ix);
1681 1681
       LOOP_L_N(iy, GRID_MAX_POINTS_Y) {
1682 1682
         ppos.y = mesh_index_to_ypos(iy);
1683
-        if (ISNAN(z_values[ix][iy])) {
1683
+        if (isnan(z_values[ix][iy])) {
1684 1684
           // undefined mesh point at (ppos.x,ppos.y), compute weighted LSF from original valid mesh points.
1685 1685
           incremental_LSF_reset(&lsf_results);
1686 1686
           xy_pos_t rpos;

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

@@ -85,7 +85,7 @@
85 85
 
86 86
       // Undefined parts of the Mesh in z_values[][] are NAN.
87 87
       // Replace NAN corrections with 0.0 to prevent NAN propagation.
88
-      if (!ISNAN(z0)) end.z += z0;
88
+      if (!isnan(z0)) end.z += z0;
89 89
       planner.buffer_segment(end, scaled_fr_mm_s, extruder);
90 90
       current_position = destination;
91 91
       return;
@@ -150,7 +150,7 @@
150 150
 
151 151
         // Undefined parts of the Mesh in z_values[][] are NAN.
152 152
         // Replace NAN corrections with 0.0 to prevent NAN propagation.
153
-        if (ISNAN(z0)) z0 = 0.0;
153
+        if (isnan(z0)) z0 = 0.0;
154 154
 
155 155
         const float ry = mesh_index_to_ypos(icell.y);
156 156
 
@@ -198,7 +198,7 @@
198 198
 
199 199
         // Undefined parts of the Mesh in z_values[][] are NAN.
200 200
         // Replace NAN corrections with 0.0 to prevent NAN propagation.
201
-        if (ISNAN(z0)) z0 = 0.0;
201
+        if (isnan(z0)) z0 = 0.0;
202 202
 
203 203
         /**
204 204
          * Without this check, it's possible to generate a zero length move, as in the case where
@@ -253,7 +253,7 @@
253 253
 
254 254
         // Undefined parts of the Mesh in z_values[][] are NAN.
255 255
         // Replace NAN corrections with 0.0 to prevent NAN propagation.
256
-        if (ISNAN(z0)) z0 = 0.0;
256
+        if (isnan(z0)) z0 = 0.0;
257 257
 
258 258
         if (!inf_normalized_flag) {
259 259
           on_axis_distance = use_x_dist ? rx - start.x : next_mesh_line_y - start.y;
@@ -276,7 +276,7 @@
276 276
 
277 277
         // Undefined parts of the Mesh in z_values[][] are NAN.
278 278
         // Replace NAN corrections with 0.0 to prevent NAN propagation.
279
-        if (ISNAN(z0)) z0 = 0.0;
279
+        if (isnan(z0)) z0 = 0.0;
280 280
 
281 281
         if (!inf_normalized_flag) {
282 282
           on_axis_distance = use_x_dist ? next_mesh_line_x - start.x : ry - start.y;
@@ -405,10 +405,10 @@
405 405
             z_x0y1 = z_values[icell.x  ][icell.y+1],  // z at lower right corner
406 406
             z_x1y1 = z_values[icell.x+1][icell.y+1];  // z at upper right corner
407 407
 
408
-      if (ISNAN(z_x0y0)) z_x0y0 = 0;              // ideally activating planner.leveling_active (G29 A)
409
-      if (ISNAN(z_x1y0)) z_x1y0 = 0;              //   should refuse if any invalid mesh points
410
-      if (ISNAN(z_x0y1)) z_x0y1 = 0;              //   in order to avoid ISNAN tests per cell,
411
-      if (ISNAN(z_x1y1)) z_x1y1 = 0;              //   thus guessing zero for undefined points
408
+      if (isnan(z_x0y0)) z_x0y0 = 0;              // ideally activating planner.leveling_active (G29 A)
409
+      if (isnan(z_x1y0)) z_x1y0 = 0;              //   should refuse if any invalid mesh points
410
+      if (isnan(z_x0y1)) z_x0y1 = 0;              //   in order to avoid isnan tests per cell,
411
+      if (isnan(z_x1y1)) z_x1y1 = 0;              //   thus guessing zero for undefined points
412 412
 
413 413
       const xy_pos_t pos = { mesh_index_to_xpos(icell.x), mesh_index_to_ypos(icell.y) };
414 414
       xy_pos_t cell = raw - pos;

+ 1
- 1
Marlin/src/gcode/bedlevel/G35.cpp View File

@@ -105,7 +105,7 @@ void GcodeSuite::G35() {
105 105
     do_blocking_move_to_z(SUM_TERN(BLTOUCH_HS_MODE, Z_CLEARANCE_BETWEEN_PROBES, 7));
106 106
     const float z_probed_height = probe.probe_at_point(screws_tilt_adjust_pos[i], PROBE_PT_RAISE, 0, true);
107 107
 
108
-    if (ISNAN(z_probed_height)) {
108
+    if (isnan(z_probed_height)) {
109 109
       SERIAL_ECHOPAIR("G35 failed at point ", i, " (");
110 110
       SERIAL_ECHOPGM_P((char *)pgm_read_ptr(&tramming_point_name[i]));
111 111
       SERIAL_CHAR(')');

+ 11
- 11
Marlin/src/gcode/bedlevel/abl/G29.cpp View File

@@ -288,11 +288,11 @@ G29_TYPE GcodeSuite::G29() {
288 288
           G29_RETURN(false);
289 289
         }
290 290
 
291
-        const float rx = RAW_X_POSITION(parser.linearval('X', MFNAN)),
292
-                    ry = RAW_Y_POSITION(parser.linearval('Y', MFNAN));
291
+        const float rx = RAW_X_POSITION(parser.linearval('X', NAN)),
292
+                    ry = RAW_Y_POSITION(parser.linearval('Y', NAN));
293 293
         int8_t i = parser.byteval('I', -1), j = parser.byteval('J', -1);
294 294
 
295
-        if (!ISNAN(rx) && !ISNAN(ry)) {
295
+        if (!isnan(rx) && !isnan(ry)) {
296 296
           // Get nearest i / j from rx / ry
297 297
           i = (rx - bilinear_start.x + 0.5 * abl.gridSpacing.x) / abl.gridSpacing.x;
298 298
           j = (ry - bilinear_start.y + 0.5 * abl.gridSpacing.y) / abl.gridSpacing.y;
@@ -609,7 +609,7 @@ G29_TYPE GcodeSuite::G29() {
609 609
 
610 610
       // Outer loop is X with PROBE_Y_FIRST enabled
611 611
       // Outer loop is Y with PROBE_Y_FIRST disabled
612
-      for (PR_OUTER_VAR = 0; PR_OUTER_VAR < PR_OUTER_SIZE && !ISNAN(abl.measured_z); PR_OUTER_VAR++) {
612
+      for (PR_OUTER_VAR = 0; PR_OUTER_VAR < PR_OUTER_SIZE && !isnan(abl.measured_z); PR_OUTER_VAR++) {
613 613
 
614 614
         int8_t inStart, inStop, inInc;
615 615
 
@@ -645,7 +645,7 @@ G29_TYPE GcodeSuite::G29() {
645 645
 
646 646
           abl.measured_z = faux ? 0.001f * random(-100, 101) : probe.probe_at_point(abl.probePos, raise_after, abl.verbose_level);
647 647
 
648
-          if (ISNAN(abl.measured_z)) {
648
+          if (isnan(abl.measured_z)) {
649 649
             set_bed_leveling_enabled(abl.reenable);
650 650
             break; // Breaks out of both loops
651 651
           }
@@ -691,14 +691,14 @@ G29_TYPE GcodeSuite::G29() {
691 691
         // Retain the last probe position
692 692
         abl.probePos = points[i];
693 693
         abl.measured_z = faux ? 0.001 * random(-100, 101) : probe.probe_at_point(abl.probePos, raise_after, abl.verbose_level);
694
-        if (ISNAN(abl.measured_z)) {
694
+        if (isnan(abl.measured_z)) {
695 695
           set_bed_leveling_enabled(abl.reenable);
696 696
           break;
697 697
         }
698 698
         points[i].z = abl.measured_z;
699 699
       }
700 700
 
701
-      if (!abl.dryrun && !ISNAN(abl.measured_z)) {
701
+      if (!abl.dryrun && !isnan(abl.measured_z)) {
702 702
         vector_3 planeNormal = vector_3::cross(points[0] - points[1], points[2] - points[1]).get_normal();
703 703
         if (planeNormal.z < 0) planeNormal *= -1;
704 704
         planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
@@ -714,7 +714,7 @@ G29_TYPE GcodeSuite::G29() {
714 714
     // Stow the probe. No raise for FIX_MOUNTED_PROBE.
715 715
     if (probe.stow()) {
716 716
       set_bed_leveling_enabled(abl.reenable);
717
-      abl.measured_z = MFNAN;
717
+      abl.measured_z = NAN;
718 718
     }
719 719
   }
720 720
   #endif // !PROBE_MANUALLY
@@ -737,7 +737,7 @@ G29_TYPE GcodeSuite::G29() {
737 737
   #endif
738 738
 
739 739
   // Calculate leveling, print reports, correct the position
740
-  if (!ISNAN(abl.measured_z)) {
740
+  if (!isnan(abl.measured_z)) {
741 741
     #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
742 742
 
743 743
       if (!abl.dryrun) extrapolate_unprobed_bed_level();
@@ -874,7 +874,7 @@ G29_TYPE GcodeSuite::G29() {
874 874
 
875 875
     // Auto Bed Leveling is complete! Enable if possible.
876 876
     planner.leveling_active = !abl.dryrun || abl.reenable;
877
-  } // !ISNAN(abl.measured_z)
877
+  } // !isnan(abl.measured_z)
878 878
 
879 879
   // Restore state after probing
880 880
   if (!faux) restore_feedrate_and_scaling();
@@ -900,7 +900,7 @@ G29_TYPE GcodeSuite::G29() {
900 900
 
901 901
   TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
902 902
 
903
-  G29_RETURN(ISNAN(abl.measured_z));
903
+  G29_RETURN(isnan(abl.measured_z));
904 904
 }
905 905
 
906 906
 #endif // HAS_ABL_NOT_UBL

+ 1
- 1
Marlin/src/gcode/bedlevel/ubl/M421.cpp View File

@@ -62,7 +62,7 @@ void GcodeSuite::M421() {
62 62
     SERIAL_ERROR_MSG(STR_ERR_MESH_XY);
63 63
   else {
64 64
     float &zval = ubl.z_values[ij.x][ij.y];
65
-    zval = hasN ? MFNAN : parser.value_linear_units() + (hasQ ? zval : 0);
65
+    zval = hasN ? NAN : parser.value_linear_units() + (hasQ ? zval : 0);
66 66
     TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ij.x, ij.y, zval));
67 67
   }
68 68
 }

+ 3
- 3
Marlin/src/gcode/calibrate/G33.cpp View File

@@ -212,7 +212,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
212 212
     if (!_7p_no_intermediates && !_7p_4_intermediates && !_7p_11_intermediates) { // probe the center
213 213
       const xy_pos_t center{0};
214 214
       z_pt[CEN] += calibration_probe(center, stow_after_each);
215
-      if (ISNAN(z_pt[CEN])) return false;
215
+      if (isnan(z_pt[CEN])) return false;
216 216
     }
217 217
 
218 218
     if (_7p_calibration) { // probe extra center points
@@ -223,7 +223,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
223 223
                     r = dcr * 0.1;
224 224
         const xy_pos_t vec = { cos(a), sin(a) };
225 225
         z_pt[CEN] += calibration_probe(vec * r, stow_after_each);
226
-        if (ISNAN(z_pt[CEN])) return false;
226
+        if (isnan(z_pt[CEN])) return false;
227 227
      }
228 228
       z_pt[CEN] /= float(_7p_2_intermediates ? 7 : probe_points);
229 229
     }
@@ -248,7 +248,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
248 248
                       interpol = FMOD(rad, 1);
249 249
           const xy_pos_t vec = { cos(a), sin(a) };
250 250
           const float z_temp = calibration_probe(vec * r, stow_after_each);
251
-          if (ISNAN(z_temp)) return false;
251
+          if (isnan(z_temp)) return false;
252 252
           // split probe point to neighbouring calibration points
253 253
           z_pt[uint8_t(LROUND(rad - interpol + NPP - 1)) % NPP + 1] += z_temp * sq(cos(RADIANS(interpol * 90)));
254 254
           z_pt[uint8_t(LROUND(rad - interpol))           % NPP + 1] += z_temp * sq(sin(RADIANS(interpol * 90)));

+ 1
- 1
Marlin/src/gcode/calibrate/G34_M422.cpp View File

@@ -229,7 +229,7 @@ void GcodeSuite::G34() {
229 229
           // Probing sanity check is disabled, as it would trigger even in normal cases because
230 230
           // current_position.z has been manually altered in the "dirty trick" above.
231 231
           const float z_probed_height = probe.probe_at_point(z_stepper_align.xy[iprobe], raise_after, 0, true, false);
232
-          if (ISNAN(z_probed_height)) {
232
+          if (isnan(z_probed_height)) {
233 233
             SERIAL_ECHOLNPGM("Probing failed");
234 234
             LCD_MESSAGEPGM(MSG_LCD_PROBING_FAILED);
235 235
             err_break = true;

+ 3
- 3
Marlin/src/gcode/calibrate/G76_M192_M871.cpp View File

@@ -113,7 +113,7 @@ void GcodeSuite::G76() {
113 113
   auto g76_probe = [](const TempSensorID sid, uint16_t &targ, const xy_pos_t &nozpos) {
114 114
     do_z_clearance(5.0); // Raise nozzle before probing
115 115
     const float measured_z = probe.probe_at_point(nozpos, PROBE_PT_STOW, 0, false);  // verbose=0, probe_relative=false
116
-    if (ISNAN(measured_z))
116
+    if (isnan(measured_z))
117 117
       SERIAL_ECHOLNPGM("!Received NAN. Aborting.");
118 118
     else {
119 119
       SERIAL_ECHOLNPAIR_F("Measured: ", measured_z);
@@ -208,7 +208,7 @@ void GcodeSuite::G76() {
208 208
         report_temps(next_temp_report);
209 209
 
210 210
       const float measured_z = g76_probe(TSI_BED, target_bed, noz_pos_xyz);
211
-      if (ISNAN(measured_z) || target_bed > BED_MAX_TARGET) break;
211
+      if (isnan(measured_z) || target_bed > BED_MAX_TARGET) break;
212 212
     }
213 213
 
214 214
     SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());
@@ -267,7 +267,7 @@ void GcodeSuite::G76() {
267 267
       if (timeout) break;
268 268
 
269 269
       const float measured_z = g76_probe(TSI_PROBE, target_probe, noz_pos_xyz);
270
-      if (ISNAN(measured_z) || target_probe > cali_info_init[TSI_PROBE].end_temp) break;
270
+      if (isnan(measured_z) || target_probe > cali_info_init[TSI_PROBE].end_temp) break;
271 271
     }
272 272
 
273 273
     SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());

+ 2
- 2
Marlin/src/gcode/calibrate/M48.cpp View File

@@ -134,7 +134,7 @@ void GcodeSuite::M48() {
134 134
 
135 135
   // Move to the first point, deploy, and probe
136 136
   const float t = probe.probe_at_point(test_position, raise_after, verbose_level);
137
-  bool probing_good = !ISNAN(t);
137
+  bool probing_good = !isnan(t);
138 138
 
139 139
   if (probing_good) {
140 140
     randomSeed(millis());
@@ -219,7 +219,7 @@ void GcodeSuite::M48() {
219 219
       const float pz = probe.probe_at_point(test_position, raise_after, 0);
220 220
 
221 221
       // Break the loop if the probe fails
222
-      probing_good = !ISNAN(pz);
222
+      probing_good = !isnan(pz);
223 223
       if (!probing_good) break;
224 224
 
225 225
       // Store the new sample

+ 1
- 1
Marlin/src/gcode/probe/G30.cpp View File

@@ -52,7 +52,7 @@ void GcodeSuite::G30() {
52 52
 
53 53
   const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
54 54
   const float measured_z = probe.probe_at_point(pos, raise_after, 1);
55
-  if (!ISNAN(measured_z))
55
+  if (!isnan(measured_z))
56 56
     SERIAL_ECHOLNPAIR("Bed X: ", pos.x, " Y: ", pos.y, " Z: ", measured_z);
57 57
 
58 58
   restore_feedrate_and_scaling();

+ 2
- 2
Marlin/src/lcd/HD44780/marlinui_HD44780.cpp View File

@@ -1460,7 +1460,7 @@ void MarlinUI::draw_status_screen() {
1460 1460
          * Print Z values
1461 1461
          */
1462 1462
         _ZLABEL(_LCD_W_POS, 1);
1463
-        if (!ISNAN(ubl.z_values[x_plot][y_plot]))
1463
+        if (!isnan(ubl.z_values[x_plot][y_plot]))
1464 1464
           lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
1465 1465
         else
1466 1466
           lcd_put_u8str_P(PSTR(" -----"));
@@ -1479,7 +1479,7 @@ void MarlinUI::draw_status_screen() {
1479 1479
          * Show the location value
1480 1480
          */
1481 1481
         _ZLABEL(_LCD_W_POS, 3);
1482
-        if (!ISNAN(ubl.z_values[x_plot][y_plot]))
1482
+        if (!isnan(ubl.z_values[x_plot][y_plot]))
1483 1483
           lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
1484 1484
         else
1485 1485
           lcd_put_u8str_P(PSTR(" -----"));

+ 1
- 1
Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp View File

@@ -943,7 +943,7 @@ void MarlinUI::draw_status_screen() {
943 943
       // Show the location value
944 944
       lcd.setCursor(_LCD_W_POS, 3); lcd_put_u8str_P(PSTR("Z:"));
945 945
 
946
-      if (!ISNAN(ubl.z_values[x_plot][y_plot]))
946
+      if (!isnan(ubl.z_values[x_plot][y_plot]))
947 947
         lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot]));
948 948
       else
949 949
         lcd_put_u8str_P(PSTR(" -----"));

+ 1
- 1
Marlin/src/lcd/dogm/marlinui_DOGM.cpp View File

@@ -569,7 +569,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
569 569
 
570 570
         // Show the location value
571 571
         lcd_put_u8str_P(74, LCD_PIXEL_HEIGHT, Z_LBL);
572
-        if (!ISNAN(ubl.z_values[x_plot][y_plot]))
572
+        if (!isnan(ubl.z_values[x_plot][y_plot]))
573 573
           lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
574 574
         else
575 575
           lcd_put_u8str_P(PSTR(" -----"));

+ 1
- 1
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/adjuster_widget.cpp View File

@@ -32,7 +32,7 @@
32 32
 namespace FTDI {
33 33
   void draw_adjuster_value(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, float value, progmem_str units, int8_t width, uint8_t precision) {
34 34
     char str[width + precision + 10 + (units ? strlen_P((const char*) units) : 0)];
35
-    if (ISNAN(value))
35
+    if (isnan(value))
36 36
       strcpy_P(str, PSTR("-"));
37 37
     else
38 38
       dtostrf(value, width, precision, str);

+ 1
- 1
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_base.cpp View File

@@ -31,7 +31,7 @@ void BedMeshBase::_drawMesh(CommandProcessor &cmd, int16_t x, int16_t y, int16_t
31 31
   constexpr uint8_t cols = GRID_MAX_POINTS_X;
32 32
 
33 33
   #define VALUE(X,Y)  (func ? func(X,Y,data) : 0)
34
-  #define ISVAL(X,Y)  (func ? !ISNAN(VALUE(X,Y)) : true)
34
+  #define ISVAL(X,Y)  (func ? !isnan(VALUE(X,Y)) : true)
35 35
   #define HEIGHT(X,Y) (ISVAL(X,Y) ? (VALUE(X,Y) - val_min) * scale_z : 0)
36 36
 
37 37
   // Compute the mean, min and max for the points

+ 1
- 1
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_edit_screen.cpp View File

@@ -79,7 +79,7 @@ void BedMeshEditScreen::onExit() {
79 79
 
80 80
 float BedMeshEditScreen::getHighlightedValue() {
81 81
   const float val = ExtUI::getMeshPoint(mydata.highlight);
82
-  return (ISNAN(val) ? 0 : val) + mydata.zAdjustment;
82
+  return (isnan(val) ? 0 : val) + mydata.zAdjustment;
83 83
 }
84 84
 
85 85
 void BedMeshEditScreen::setHighlightedValue(float value) {

+ 2
- 2
Marlin/src/lcd/extui/ui_api.cpp View File

@@ -421,7 +421,7 @@ namespace ExtUI {
421 421
         #if AXIS_IS_TMC(Z2)
422 422
           case Z2: return stepperZ2.getMilliamps();
423 423
         #endif
424
-        default: return MFNAN;
424
+        default: return NAN;
425 425
       };
426 426
     }
427 427
 
@@ -451,7 +451,7 @@ namespace ExtUI {
451 451
         #if AXIS_IS_TMC(E7)
452 452
           case E7: return stepperE7.getMilliamps();
453 453
         #endif
454
-        default: return MFNAN;
454
+        default: return NAN;
455 455
       };
456 456
     }
457 457
 

+ 1
- 1
Marlin/src/lcd/menu/menu_tramming.cpp View File

@@ -54,7 +54,7 @@ static bool probe_single_point() {
54 54
   z_measured[tram_index] = z_probed_height;
55 55
   move_to_tramming_wait_pos();
56 56
 
57
-  return !ISNAN(z_probed_height);
57
+  return !isnan(z_probed_height);
58 58
 }
59 59
 
60 60
 static void _menu_single_probe(const uint8_t point) {

+ 1
- 1
Marlin/src/lcd/tft/ui_1024x600.cpp View File

@@ -505,7 +505,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
505 505
     tft.set_background(COLOR_BACKGROUND);
506 506
     tft_string.set(Z_LBL);
507 507
     tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
508
-    tft_string.set(ISNAN(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot]));
508
+    tft_string.set(isnan(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot]));
509 509
     tft_string.trim();
510 510
     tft.add_text(120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
511 511
 

+ 1
- 1
Marlin/src/lcd/tft/ui_320x240.cpp View File

@@ -492,7 +492,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
492 492
     tft.set_background(COLOR_BACKGROUND);
493 493
     tft_string.set(Z_LBL);
494 494
     tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
495
-    tft_string.set(ISNAN(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot]));
495
+    tft_string.set(isnan(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot]));
496 496
     tft_string.trim();
497 497
     tft.add_text(96 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
498 498
 

+ 1
- 1
Marlin/src/lcd/tft/ui_480x320.cpp View File

@@ -492,7 +492,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
492 492
     tft.set_background(COLOR_BACKGROUND);
493 493
     tft_string.set(Z_LBL);
494 494
     tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
495
-    tft_string.set(ISNAN(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot]));
495
+    tft_string.set(isnan(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot]));
496 496
     tft_string.trim();
497 497
     tft.add_text(120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
498 498
 

+ 10
- 10
Marlin/src/module/probe.cpp View File

@@ -583,7 +583,7 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
583 583
  * @details Used by probe_at_point to get the bed Z height at the current XY.
584 584
  *          Leaves current_position.z at the height where the probe triggered.
585 585
  *
586
- * @return The Z position of the bed at the current XY or MFNAN on error.
586
+ * @return The Z position of the bed at the current XY or NAN on error.
587 587
  */
588 588
 float Probe::run_z_probe(const bool sanity_check/*=true*/) {
589 589
   DEBUG_SECTION(log_probe, "Probe::run_z_probe", DEBUGGING(LEVELING));
@@ -617,11 +617,11 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
617 617
   #if TOTAL_PROBING == 2
618 618
 
619 619
     // Attempt to tare the probe
620
-    if (TERN0(PROBE_TARE, tare())) return MFNAN;
620
+    if (TERN0(PROBE_TARE, tare())) return NAN;
621 621
 
622 622
     // Do a first probe at the fast speed
623 623
     if (try_to_probe(PSTR("FAST"), z_probe_low_point, z_probe_fast_mm_s,
624
-                     sanity_check, Z_CLEARANCE_BETWEEN_PROBES) ) return MFNAN;
624
+                     sanity_check, Z_CLEARANCE_BETWEEN_PROBES) ) return NAN;
625 625
 
626 626
     const float first_probe_z = current_position.z;
627 627
 
@@ -662,7 +662,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
662 662
 
663 663
       // Probe downward slowly to find the bed
664 664
       if (try_to_probe(PSTR("SLOW"), z_probe_low_point, MMM_TO_MMS(Z_PROBE_FEEDRATE_SLOW),
665
-                       sanity_check, Z_CLEARANCE_MULTI_PROBE) ) return MFNAN;
665
+                       sanity_check, Z_CLEARANCE_MULTI_PROBE) ) return NAN;
666 666
 
667 667
       TERN_(MEASURE_BACKLASH_WHEN_PROBING, backlash.measure_with_probe());
668 668
 
@@ -765,29 +765,29 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
765 765
   if (probe_relative) {                                     // The given position is in terms of the probe
766 766
     if (!can_reach(npos)) {
767 767
       if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Position Not Reachable");
768
-      return MFNAN;
768
+      return NAN;
769 769
     }
770 770
     npos -= offset_xy;                                      // Get the nozzle position
771 771
   }
772
-  else if (!position_is_reachable(npos)) return MFNAN;      // The given position is in terms of the nozzle
772
+  else if (!position_is_reachable(npos)) return NAN;        // The given position is in terms of the nozzle
773 773
 
774 774
   // Move the probe to the starting XYZ
775 775
   do_blocking_move_to(npos, feedRate_t(XY_PROBE_FEEDRATE_MM_S));
776 776
 
777
-  float measured_z = MFNAN;
777
+  float measured_z = NAN;
778 778
   if (!deploy()) measured_z = run_z_probe(sanity_check) + offset.z;
779
-  if (!ISNAN(measured_z)) {
779
+  if (!isnan(measured_z)) {
780 780
     const bool big_raise = raise_after == PROBE_PT_BIG_RAISE;
781 781
     if (big_raise || raise_after == PROBE_PT_RAISE)
782 782
       do_blocking_move_to_z(current_position.z + (big_raise ? 25 : Z_CLEARANCE_BETWEEN_PROBES), z_probe_fast_mm_s);
783 783
     else if (raise_after == PROBE_PT_STOW)
784
-      if (stow()) measured_z = MFNAN;   // Error on stow?
784
+      if (stow()) measured_z = NAN;   // Error on stow?
785 785
 
786 786
     if (verbose_level > 2)
787 787
       SERIAL_ECHOLNPAIR("Bed X: ", LOGICAL_X_POSITION(rx), " Y: ", LOGICAL_Y_POSITION(ry), " Z: ", measured_z);
788 788
   }
789 789
 
790
-  if (ISNAN(measured_z)) {
790
+  if (isnan(measured_z)) {
791 791
     stow();
792 792
     LCD_MESSAGEPGM(MSG_LCD_PROBING_FAILED);
793 793
     #if DISABLED(G29_RETRY_AND_RECOVER)

+ 7
- 7
Marlin/src/module/settings.cpp View File

@@ -900,8 +900,8 @@ void MarlinSettings::postprocess() {
900 900
       HOTEND_LOOP() {
901 901
         PIDCF_t pidcf = {
902 902
           #if DISABLED(PIDTEMP)
903
-            MFNAN, MFNAN, MFNAN,
904
-            MFNAN, MFNAN
903
+            NAN, NAN, NAN,
904
+            NAN, NAN
905 905
           #else
906 906
                          PID_PARAM(Kp, e),
907 907
             unscalePID_i(PID_PARAM(Ki, e)),
@@ -928,7 +928,7 @@ void MarlinSettings::postprocess() {
928 928
 
929 929
       const PID_t bed_pid = {
930 930
         #if DISABLED(PIDTEMPBED)
931
-          MFNAN, MFNAN, MFNAN
931
+          NAN, NAN, NAN
932 932
         #else
933 933
           // Store the unscaled PID values
934 934
           thermalManager.temp_bed.pid.Kp,
@@ -947,7 +947,7 @@ void MarlinSettings::postprocess() {
947 947
 
948 948
       const PID_t chamber_pid = {
949 949
         #if DISABLED(PIDTEMPCHAMBER)
950
-          MFNAN, MFNAN, MFNAN
950
+          NAN, NAN, NAN
951 951
         #else
952 952
           // Store the unscaled PID values
953 953
           thermalManager.temp_chamber.pid.Kp,
@@ -1786,7 +1786,7 @@ void MarlinSettings::postprocess() {
1786 1786
           PIDCF_t pidcf;
1787 1787
           EEPROM_READ(pidcf);
1788 1788
           #if ENABLED(PIDTEMP)
1789
-            if (!validating && !ISNAN(pidcf.Kp)) {
1789
+            if (!validating && !isnan(pidcf.Kp)) {
1790 1790
               // Scale PID values since EEPROM values are unscaled
1791 1791
               PID_PARAM(Kp, e) = pidcf.Kp;
1792 1792
               PID_PARAM(Ki, e) = scalePID_i(pidcf.Ki);
@@ -1818,7 +1818,7 @@ void MarlinSettings::postprocess() {
1818 1818
         PID_t pid;
1819 1819
         EEPROM_READ(pid);
1820 1820
         #if ENABLED(PIDTEMPBED)
1821
-          if (!validating && !ISNAN(pid.Kp)) {
1821
+          if (!validating && !isnan(pid.Kp)) {
1822 1822
             // Scale PID values since EEPROM values are unscaled
1823 1823
             thermalManager.temp_bed.pid.Kp = pid.Kp;
1824 1824
             thermalManager.temp_bed.pid.Ki = scalePID_i(pid.Ki);
@@ -1834,7 +1834,7 @@ void MarlinSettings::postprocess() {
1834 1834
         PID_t pid;
1835 1835
         EEPROM_READ(pid);
1836 1836
         #if ENABLED(PIDTEMPCHAMBER)
1837
-          if (!validating && !ISNAN(pid.Kp)) {
1837
+          if (!validating && !isnan(pid.Kp)) {
1838 1838
             // Scale PID values since EEPROM values are unscaled
1839 1839
             thermalManager.temp_chamber.pid.Kp = pid.Kp;
1840 1840
             thermalManager.temp_chamber.pid.Ki = scalePID_i(pid.Ki);

+ 3
- 3
Marlin/src/module/temperature.h View File

@@ -74,9 +74,9 @@ hotend_pid_t;
74 74
 #endif
75 75
 
76 76
 #define PID_PARAM(F,H) _PID_##F(TERN(PID_PARAMS_PER_HOTEND, H, 0 & H)) // Always use 'H' to suppress warning
77
-#define _PID_Kp(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Kp, MFNAN)
78
-#define _PID_Ki(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Ki, MFNAN)
79
-#define _PID_Kd(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Kd, MFNAN)
77
+#define _PID_Kp(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Kp, NAN)
78
+#define _PID_Ki(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Ki, NAN)
79
+#define _PID_Kd(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Kd, NAN)
80 80
 #if ENABLED(PIDTEMP)
81 81
   #define _PID_Kc(H) TERN(PID_EXTRUSION_SCALING, Temperature::temp_hotend[H].pid.Kc, 1)
82 82
   #define _PID_Kf(H) TERN(PID_FAN_SCALING,       Temperature::temp_hotend[H].pid.Kf, 0)

+ 1
- 1
platformio.ini View File

@@ -38,7 +38,7 @@ extra_configs =
38 38
 # The 'common' values are used for most Marlin builds
39 39
 #
40 40
 [common]
41
-build_flags        = -fmax-errors=5 -g3 -D__MARLIN_FIRMWARE__ -fmerge-constants -fno-signed-zeros -ffinite-math-only
41
+build_flags        = -fmax-errors=5 -g3 -D__MARLIN_FIRMWARE__ -fmerge-constants
42 42
 extra_scripts      =
43 43
   pre:buildroot/share/PlatformIO/scripts/common-dependencies.py
44 44
   pre:buildroot/share/PlatformIO/scripts/common-cxxflags.py

Loading…
Cancel
Save