|
@ -565,14 +565,14 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#ifdef EXTRA_PROBING |
|
|
#if EXTRA_PROBING > 0 |
|
|
float probes[TOTAL_PROBING]; |
|
|
float probes[TOTAL_PROBING]; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if TOTAL_PROBING > 2 |
|
|
#if TOTAL_PROBING > 2 |
|
|
float probes_z_sum = 0; |
|
|
float probes_z_sum = 0; |
|
|
for ( |
|
|
for ( |
|
|
#if EXTRA_PROBING |
|
|
#if EXTRA_PROBING > 0 |
|
|
uint8_t p = 0; p < TOTAL_PROBING; p++ |
|
|
uint8_t p = 0; p < TOTAL_PROBING; p++ |
|
|
#else |
|
|
#else |
|
|
uint8_t p = TOTAL_PROBING; p--; |
|
|
uint8_t p = TOTAL_PROBING; p--; |
|
@ -588,7 +588,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { |
|
|
|
|
|
|
|
|
const float z = current_position.z; |
|
|
const float z = current_position.z; |
|
|
|
|
|
|
|
|
#if EXTRA_PROBING |
|
|
#if EXTRA_PROBING > 0 |
|
|
// Insert Z measurement into probes[]. Keep it sorted ascending.
|
|
|
// Insert Z measurement into probes[]. Keep it sorted ascending.
|
|
|
LOOP_LE_N(i, p) { // Iterate the saved Zs to insert the new Z
|
|
|
LOOP_LE_N(i, p) { // Iterate the saved Zs to insert the new Z
|
|
|
if (i == p || probes[i] > z) { // Last index or new Z is smaller than this Z
|
|
|
if (i == p || probes[i] > z) { // Last index or new Z is smaller than this Z
|
|
@ -605,14 +605,17 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { |
|
|
|
|
|
|
|
|
#if TOTAL_PROBING > 2 |
|
|
#if TOTAL_PROBING > 2 |
|
|
// Small Z raise after all but the last probe
|
|
|
// Small Z raise after all but the last probe
|
|
|
if (TERN(EXTRA_PROBING, p < TOTAL_PROBING - 1, p)) |
|
|
if (p |
|
|
do_blocking_move_to_z(z + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST)); |
|
|
#if EXTRA_PROBING > 0 |
|
|
|
|
|
< TOTAL_PROBING - 1 |
|
|
|
|
|
#endif |
|
|
|
|
|
) do_blocking_move_to_z(z + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST)); |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#if TOTAL_PROBING > 2 |
|
|
#if TOTAL_PROBING > 2 |
|
|
|
|
|
|
|
|
#if EXTRA_PROBING |
|
|
#if EXTRA_PROBING > 0 |
|
|
// Take the center value (or average the two middle values) as the median
|
|
|
// Take the center value (or average the two middle values) as the median
|
|
|
static constexpr int PHALF = (TOTAL_PROBING - 1) / 2; |
|
|
static constexpr int PHALF = (TOTAL_PROBING - 1) / 2; |
|
|
const float middle = probes[PHALF], |
|
|
const float middle = probes[PHALF], |
|
|