|
@@ -507,7 +507,7 @@ static bool do_probe_move(const float z, const float fr_mm_m) {
|
507
|
507
|
}
|
508
|
508
|
|
509
|
509
|
/**
|
510
|
|
- * @details Used by probe_pt to do a single Z probe.
|
|
510
|
+ * @details Used by probe_pt to do a single Z probe at the current position.
|
511
|
511
|
* Leaves current_position[Z_AXIS] at the height where the probe triggered.
|
512
|
512
|
*
|
513
|
513
|
* @return The raw Z position where the probe was triggered
|
|
@@ -521,7 +521,8 @@ static float run_z_probe() {
|
521
|
521
|
// Prevent stepper_inactive_time from running out and EXTRUDER_RUNOUT_PREVENT from extruding
|
522
|
522
|
gcode.refresh_cmd_timeout();
|
523
|
523
|
|
524
|
|
- #if ENABLED(PROBE_DOUBLE_TOUCH)
|
|
524
|
+ // Double-probing does a fast probe followed by a slow probe
|
|
525
|
+ #if MULTIPLE_PROBING == 2
|
525
|
526
|
|
526
|
527
|
// Do a first probe at the fast speed
|
527
|
528
|
if (do_probe_move(-10, Z_PROBE_SPEED_FAST)) return NAN;
|
|
@@ -549,22 +550,49 @@ static float run_z_probe() {
|
549
|
550
|
}
|
550
|
551
|
#endif
|
551
|
552
|
|
552
|
|
- // Move down slowly to find bed, not too far
|
553
|
|
- if (do_probe_move(-10, Z_PROBE_SPEED_SLOW)) return NAN;
|
554
|
|
-
|
555
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
556
|
|
- if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position);
|
|
553
|
+ #if MULTIPLE_PROBING > 2
|
|
554
|
+ float probes_total = 0;
|
|
555
|
+ for (uint8_t p = MULTIPLE_PROBING + 1; --p;) {
|
557
|
556
|
#endif
|
558
|
557
|
|
559
|
|
- // Debug: compare probe heights
|
560
|
|
- #if ENABLED(PROBE_DOUBLE_TOUCH) && ENABLED(DEBUG_LEVELING_FEATURE)
|
561
|
|
- if (DEBUGGING(LEVELING)) {
|
562
|
|
- SERIAL_ECHOPAIR("2nd Probe Z:", current_position[Z_AXIS]);
|
563
|
|
- SERIAL_ECHOLNPAIR(" Discrepancy:", first_probe_z - current_position[Z_AXIS]);
|
|
558
|
+ // Move down slowly to find bed, not too far
|
|
559
|
+ if (do_probe_move(-10, Z_PROBE_SPEED_SLOW)) return NAN;
|
|
560
|
+
|
|
561
|
+ #if MULTIPLE_PROBING > 2
|
|
562
|
+ probes_total += current_position[Z_AXIS];
|
|
563
|
+ if (p > 1) do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
|
564
|
564
|
}
|
565
|
565
|
#endif
|
566
|
566
|
|
567
|
|
- return current_position[Z_AXIS];
|
|
567
|
+ #if MULTIPLE_PROBING > 2
|
|
568
|
+
|
|
569
|
+ // Return the average value of all probes
|
|
570
|
+ return probes_total * (1.0 / (MULTIPLE_PROBING));
|
|
571
|
+
|
|
572
|
+ #elif MULTIPLE_PROBING == 2
|
|
573
|
+
|
|
574
|
+ const float z2 = current_position[Z_AXIS];
|
|
575
|
+
|
|
576
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
577
|
+ if (DEBUGGING(LEVELING)) {
|
|
578
|
+ SERIAL_ECHOPAIR("2nd Probe Z:", z2);
|
|
579
|
+ SERIAL_ECHOLNPAIR(" Discrepancy:", first_probe_z - z2);
|
|
580
|
+ }
|
|
581
|
+ #endif
|
|
582
|
+
|
|
583
|
+ // Return a weighted average of the fast and slow probes
|
|
584
|
+ return (z2 * 3.0 + first_probe_z * 2.0) * 0.2;
|
|
585
|
+
|
|
586
|
+ #else
|
|
587
|
+
|
|
588
|
+ // Return the single probe result
|
|
589
|
+ return current_position[Z_AXIS];
|
|
590
|
+
|
|
591
|
+ #endif
|
|
592
|
+
|
|
593
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
594
|
+ if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position);
|
|
595
|
+ #endif
|
568
|
596
|
}
|
569
|
597
|
|
570
|
598
|
/**
|