Improve probe logging

This commit is contained in:
Scott Lahteine 2018-05-29 21:54:13 -05:00
parent 3f2a062a57
commit b90f54b0fc

View file

@ -554,7 +554,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
* *
* @return The raw Z position where the probe was triggered * @return The raw Z position where the probe was triggered
*/ */
static float run_z_probe() { static float run_z_probe() {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS(">>> run_z_probe", current_position); if (DEBUGGING(LEVELING)) DEBUG_POS(">>> run_z_probe", current_position);
@ -568,7 +568,15 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
#if MULTIPLE_PROBING == 2 #if MULTIPLE_PROBING == 2
// Do a first probe at the fast speed // Do a first probe at the fast speed
if (do_probe_move(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_FAST))) return NAN; if (do_probe_move(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_FAST))) {
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOLNPGM("FAST Probe fail!");
DEBUG_POS("<<< run_z_probe", current_position);
}
#endif
return NAN;
}
float first_probe_z = current_position[Z_AXIS]; float first_probe_z = current_position[Z_AXIS];
@ -598,8 +606,16 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
for (uint8_t p = MULTIPLE_PROBING + 1; --p;) { for (uint8_t p = MULTIPLE_PROBING + 1; --p;) {
#endif #endif
// Move down slowly to find bed, not too far // move down slowly to find bed
if (do_probe_move(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_SLOW))) return NAN; if (do_probe_move(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_SLOW))) {
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOLNPGM("SLOW Probe fail!");
DEBUG_POS("<<< run_z_probe", current_position);
}
#endif
return NAN;
}
#if MULTIPLE_PROBING > 2 #if MULTIPLE_PROBING > 2
probes_total += current_position[Z_AXIS]; probes_total += current_position[Z_AXIS];
@ -610,7 +626,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
#if MULTIPLE_PROBING > 2 #if MULTIPLE_PROBING > 2
// Return the average value of all probes // Return the average value of all probes
return probes_total * (1.0 / (MULTIPLE_PROBING)); const float measured_z = probes_total * (1.0 / (MULTIPLE_PROBING));
#elif MULTIPLE_PROBING == 2 #elif MULTIPLE_PROBING == 2
@ -624,18 +640,20 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
#endif #endif
// Return a weighted average of the fast and slow probes // Return a weighted average of the fast and slow probes
return (z2 * 3.0 + first_probe_z * 2.0) * 0.2; const float measured_z = (z2 * 3.0 + first_probe_z * 2.0) * 0.2;
#else #else
// Return the single probe result // Return the single probe result
return current_position[Z_AXIS]; const float measured_z = current_position[Z_AXIS];
#endif #endif
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position); if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position);
#endif #endif
return measured_z;
} }
/** /**
@ -705,10 +723,6 @@ float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/
SERIAL_EOL(); SERIAL_EOL();
} }
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< probe_pt");
#endif
feedrate_mm_s = old_feedrate_mm_s; feedrate_mm_s = old_feedrate_mm_s;
if (isnan(measured_z)) { if (isnan(measured_z)) {
@ -717,6 +731,10 @@ float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/
SERIAL_ERRORLNPGM(MSG_ERR_PROBING_FAILED); SERIAL_ERRORLNPGM(MSG_ERR_PROBING_FAILED);
} }
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< probe_pt");
#endif
return measured_z; return measured_z;
} }