Преглед изворни кода

Merge pull request #6289 from zlowred/RCBugFix

Fixed comparison of float values to NaN
Scott Lahteine пре 8 година
родитељ
комит
2bde7940e0
1 измењених фајлова са 7 додато и 7 уклоњено
  1. 7
    7
      Marlin/Marlin_main.cpp

+ 7
- 7
Marlin/Marlin_main.cpp Прегледај датотеку

@@ -2400,7 +2400,7 @@ static void clean_up_after_endstop_or_probe_move() {
2400 2400
       for (uint8_t x = 0; x < sx; x++) {
2401 2401
         SERIAL_PROTOCOLCHAR(' ');
2402 2402
         const float offset = fn(x, y);
2403
-        if (offset != NAN) {
2403
+        if (!isnan(offset)) {
2404 2404
           if (offset >= 0) SERIAL_PROTOCOLCHAR('+');
2405 2405
           SERIAL_PROTOCOL_F(offset, precision);
2406 2406
         }
@@ -2452,7 +2452,7 @@ static void clean_up_after_endstop_or_probe_move() {
2452 2452
         SERIAL_CHAR(']');
2453 2453
       }
2454 2454
     #endif
2455
-    if (bed_level_grid[x][y] != NAN) {
2455
+    if (!isnan(bed_level_grid[x][y])) {
2456 2456
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2457 2457
         if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM(" (done)");
2458 2458
       #endif
@@ -2466,9 +2466,9 @@ static void clean_up_after_endstop_or_probe_move() {
2466 2466
           c1 = bed_level_grid[x + xdir][y + ydir], c2 = bed_level_grid[x + xdir * 2][y + ydir * 2];
2467 2467
 
2468 2468
     // Treat far unprobed points as zero, near as equal to far
2469
-    if (a2 == NAN) a2 = 0.0; if (a1 == NAN) a1 = a2;
2470
-    if (b2 == NAN) b2 = 0.0; if (b1 == NAN) b1 = b2;
2471
-    if (c2 == NAN) c2 = 0.0; if (c1 == NAN) c1 = c2;
2469
+    if (isnan(a2)) a2 = 0.0; if (isnan(a1)) a1 = a2;
2470
+    if (isnan(b2)) b2 = 0.0; if (isnan(b1)) b1 = b2;
2471
+    if (isnan(c2)) c2 = 0.0; if (isnan(c1)) c1 = c2;
2472 2472
 
2473 2473
     const float a = 2 * a1 - a2, b = 2 * b1 - b2, c = 2 * c1 - c2;
2474 2474
 
@@ -4498,7 +4498,7 @@ inline void gcode_G28() {
4498 4498
 
4499 4499
             measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
4500 4500
 
4501
-            if (measured_z == NAN) {
4501
+            if (isnan(measured_z)) {
4502 4502
               planner.abl_enabled = abl_should_enable;
4503 4503
               return;
4504 4504
             }
@@ -4534,7 +4534,7 @@ inline void gcode_G28() {
4534 4534
           measured_z = points[i].z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
4535 4535
         }
4536 4536
 
4537
-        if (measured_z == NAN) {
4537
+        if (isnan(measured_z)) {
4538 4538
           planner.abl_enabled = abl_should_enable;
4539 4539
           return;
4540 4540
         }

Loading…
Откажи
Сачувај