Fix TERN typo, EXTRA_PROBING
Co-Authored-By: Matthew Kennedy <mattkenn4545@gmail.com>
This commit is contained in:
parent
32dc874928
commit
e5b0892f08
|
@ -605,7 +605,7 @@
|
||||||
#define PROBE_TRIGGERED_WHEN_STOWED_TEST 1 // Extra test for Allen Key Probe
|
#define PROBE_TRIGGERED_WHEN_STOWED_TEST 1 // Extra test for Allen Key Probe
|
||||||
#endif
|
#endif
|
||||||
#if MULTIPLE_PROBING > 1
|
#if MULTIPLE_PROBING > 1
|
||||||
#if EXTRA_PROBING
|
#if EXTRA_PROBING > 0
|
||||||
#define TOTAL_PROBING (MULTIPLE_PROBING + EXTRA_PROBING)
|
#define TOTAL_PROBING (MULTIPLE_PROBING + EXTRA_PROBING)
|
||||||
#else
|
#else
|
||||||
#define TOTAL_PROBING MULTIPLE_PROBING
|
#define TOTAL_PROBING MULTIPLE_PROBING
|
||||||
|
|
|
@ -1285,8 +1285,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||||
#error "Probes need Z_AFTER_PROBING >= 0."
|
#error "Probes need Z_AFTER_PROBING >= 0."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MULTIPLE_PROBING || EXTRA_PROBING
|
#if MULTIPLE_PROBING > 0 || EXTRA_PROBING > 0
|
||||||
#if !MULTIPLE_PROBING
|
#if MULTIPLE_PROBING == 0
|
||||||
#error "EXTRA_PROBING requires MULTIPLE_PROBING."
|
#error "EXTRA_PROBING requires MULTIPLE_PROBING."
|
||||||
#elif MULTIPLE_PROBING < 2
|
#elif MULTIPLE_PROBING < 2
|
||||||
#error "MULTIPLE_PROBING must be 2 or more."
|
#error "MULTIPLE_PROBING must be 2 or more."
|
||||||
|
|
|
@ -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],
|
||||||
|
|
Loading…
Reference in a new issue