Browse Source

Fix TERN typo, EXTRA_PROBING

Co-Authored-By: Matthew Kennedy <mattkenn4545@gmail.com>
Scott Lahteine 5 years ago
parent
commit
e5b0892f08
3 changed files with 12 additions and 9 deletions
  1. 1
    1
      Marlin/src/inc/Conditionals_LCD.h
  2. 2
    2
      Marlin/src/inc/SanityCheck.h
  3. 9
    6
      Marlin/src/module/probe.cpp

+ 1
- 1
Marlin/src/inc/Conditionals_LCD.h View File

605
     #define PROBE_TRIGGERED_WHEN_STOWED_TEST 1 // Extra test for Allen Key Probe
605
     #define PROBE_TRIGGERED_WHEN_STOWED_TEST 1 // Extra test for Allen Key Probe
606
   #endif
606
   #endif
607
   #if MULTIPLE_PROBING > 1
607
   #if MULTIPLE_PROBING > 1
608
-    #if EXTRA_PROBING
608
+    #if EXTRA_PROBING > 0
609
       #define TOTAL_PROBING (MULTIPLE_PROBING + EXTRA_PROBING)
609
       #define TOTAL_PROBING (MULTIPLE_PROBING + EXTRA_PROBING)
610
     #else
610
     #else
611
       #define TOTAL_PROBING MULTIPLE_PROBING
611
       #define TOTAL_PROBING MULTIPLE_PROBING

+ 2
- 2
Marlin/src/inc/SanityCheck.h View File

1285
     #error "Probes need Z_AFTER_PROBING >= 0."
1285
     #error "Probes need Z_AFTER_PROBING >= 0."
1286
   #endif
1286
   #endif
1287
 
1287
 
1288
-  #if MULTIPLE_PROBING || EXTRA_PROBING
1289
-    #if !MULTIPLE_PROBING
1288
+  #if MULTIPLE_PROBING > 0 || EXTRA_PROBING > 0
1289
+    #if MULTIPLE_PROBING == 0
1290
       #error "EXTRA_PROBING requires MULTIPLE_PROBING."
1290
       #error "EXTRA_PROBING requires MULTIPLE_PROBING."
1291
     #elif MULTIPLE_PROBING < 2
1291
     #elif MULTIPLE_PROBING < 2
1292
       #error "MULTIPLE_PROBING must be 2 or more."
1292
       #error "MULTIPLE_PROBING must be 2 or more."

+ 9
- 6
Marlin/src/module/probe.cpp View File

565
     }
565
     }
566
   #endif
566
   #endif
567
 
567
 
568
-  #ifdef EXTRA_PROBING
568
+  #if EXTRA_PROBING > 0
569
     float probes[TOTAL_PROBING];
569
     float probes[TOTAL_PROBING];
570
   #endif
570
   #endif
571
 
571
 
572
   #if TOTAL_PROBING > 2
572
   #if TOTAL_PROBING > 2
573
     float probes_z_sum = 0;
573
     float probes_z_sum = 0;
574
     for (
574
     for (
575
-      #if EXTRA_PROBING
575
+      #if EXTRA_PROBING > 0
576
         uint8_t p = 0; p < TOTAL_PROBING; p++
576
         uint8_t p = 0; p < TOTAL_PROBING; p++
577
       #else
577
       #else
578
         uint8_t p = TOTAL_PROBING; p--;
578
         uint8_t p = TOTAL_PROBING; p--;
588
 
588
 
589
       const float z = current_position.z;
589
       const float z = current_position.z;
590
 
590
 
591
-      #if EXTRA_PROBING
591
+      #if EXTRA_PROBING > 0
592
         // Insert Z measurement into probes[]. Keep it sorted ascending.
592
         // Insert Z measurement into probes[]. Keep it sorted ascending.
593
         LOOP_LE_N(i, p) {                            // Iterate the saved Zs to insert the new Z
593
         LOOP_LE_N(i, p) {                            // Iterate the saved Zs to insert the new Z
594
           if (i == p || probes[i] > z) {                              // Last index or new Z is smaller than this Z
594
           if (i == p || probes[i] > z) {                              // Last index or new Z is smaller than this Z
605
 
605
 
606
       #if TOTAL_PROBING > 2
606
       #if TOTAL_PROBING > 2
607
         // Small Z raise after all but the last probe
607
         // Small Z raise after all but the last probe
608
-        if (TERN(EXTRA_PROBING, p < TOTAL_PROBING - 1, p))
609
-          do_blocking_move_to_z(z + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
608
+        if (p
609
+          #if EXTRA_PROBING > 0
610
+            < TOTAL_PROBING - 1
611
+          #endif
612
+        ) do_blocking_move_to_z(z + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
610
       #endif
613
       #endif
611
     }
614
     }
612
 
615
 
613
   #if TOTAL_PROBING > 2
616
   #if TOTAL_PROBING > 2
614
 
617
 
615
-    #if EXTRA_PROBING
618
+    #if EXTRA_PROBING > 0
616
       // Take the center value (or average the two middle values) as the median
619
       // Take the center value (or average the two middle values) as the median
617
       static constexpr int PHALF = (TOTAL_PROBING - 1) / 2;
620
       static constexpr int PHALF = (TOTAL_PROBING - 1) / 2;
618
       const float middle = probes[PHALF],
621
       const float middle = probes[PHALF],

Loading…
Cancel
Save