PROBE_DOUBLE_TOUCH => MULTIPLE_PROBING

master
Scott Lahteine 8 years ago committed by Scott Lahteine
parent 6e85c060a9
commit 44800e9899

@ -690,14 +690,16 @@
// X and Y axis travel speed (mm/m) between probes
#define XY_PROBE_SPEED 8000
// Speed for the first approach when double-probing (with PROBE_DOUBLE_TOUCH)
// Speed for the first approach when double-probing (MULTIPLE_PROBING == 2)
#define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z
// Speed for the "accurate" probe of each point
#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2)
// Use double touch for probing
//#define PROBE_DOUBLE_TOUCH
// The number of probes to perform at each point.
// Set to 2 for a fast/slow probe, using the second probe result.
// Set to 3 or more for slow probes, averaging the results.
//#define MULTIPLE_PROBING 2
/**
* Z probes require clearance when deploying, stowing, and moving between

@ -742,7 +742,7 @@
//#define BEZIER_CURVE_SUPPORT
// G38.2 and G38.3 Probe Target
// Enable PROBE_DOUBLE_TOUCH if you want G38 to double touch
// Set MULTIPLE_PROBING if you want G38 to double touch
//#define G38_PROBE_TARGET
#if ENABLED(G38_PROBE_TARGET)
#define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move)

@ -2215,7 +2215,7 @@ static void clean_up_after_endstop_or_probe_move() {
}
/**
* @details Used by probe_pt to do a single Z probe.
* @details Used by probe_pt to do a single Z probe at the current position.
* Leaves current_position[Z_AXIS] at the height where the probe triggered.
*
* @return The raw Z position where the probe was triggered
@ -2229,7 +2229,8 @@ static void clean_up_after_endstop_or_probe_move() {
// Prevent stepper_inactive_time from running out and EXTRUDER_RUNOUT_PREVENT from extruding
refresh_cmd_timeout();
#if ENABLED(PROBE_DOUBLE_TOUCH)
// Double-probing does a fast probe followed by a slow probe
#if MULTIPLE_PROBING == 2
// Do a first probe at the fast speed
if (do_probe_move(-10, Z_PROBE_SPEED_FAST)) return NAN;
@ -2257,22 +2258,49 @@ static void clean_up_after_endstop_or_probe_move() {
}
#endif
// move down slowly to find bed
if (do_probe_move(-10, Z_PROBE_SPEED_SLOW)) return NAN;
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position);
#if MULTIPLE_PROBING > 2
float probes_total = 0;
for (uint8_t p = MULTIPLE_PROBING + 1; --p;) {
#endif
// Debug: compare probe heights
#if ENABLED(PROBE_DOUBLE_TOUCH) && ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("2nd Probe Z:", current_position[Z_AXIS]);
SERIAL_ECHOLNPAIR(" Discrepancy:", first_probe_z - current_position[Z_AXIS]);
// move down slowly to find bed
if (do_probe_move(-10, Z_PROBE_SPEED_SLOW)) return NAN;
#if MULTIPLE_PROBING > 2
probes_total += current_position[Z_AXIS];
if (p > 1) do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
}
#endif
return current_position[Z_AXIS];
#if MULTIPLE_PROBING > 2
// Return the average value of all probes
return probes_total * (1.0 / (MULTIPLE_PROBING));
#elif MULTIPLE_PROBING == 2
const float z2 = current_position[Z_AXIS];
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("2nd Probe Z:", z2);
SERIAL_ECHOLNPAIR(" Discrepancy:", first_probe_z - z2);
}
#endif
// Return a weighted average of the fast and slow probes
return (z2 * 3.0 + first_probe_z * 2.0) * 0.2;
#else
// Return the single probe result
return current_position[Z_AXIS];
#endif
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position);
#endif
}
/**
@ -6005,7 +6033,7 @@ void home_all_axes() { gcode_G28(true); }
bool G38_pass_fail = false;
#if ENABLED(PROBE_DOUBLE_TOUCH)
#if MULTIPLE_PROBING > 1
// Get direction of move and retract
float retract_mm[XYZ];
LOOP_XYZ(i) {
@ -6032,7 +6060,7 @@ void home_all_axes() { gcode_G28(true); }
G38_pass_fail = true;
#if ENABLED(PROBE_DOUBLE_TOUCH)
#if MULTIPLE_PROBING > 1
// Move away by the retract distance
set_destination_from_current();
LOOP_XYZ(i) destination[i] += retract_mm[i];

@ -224,6 +224,8 @@
#error "UBL_GRANULAR_SEGMENTATION_FOR_CARTESIAN is now SEGMENT_LEVELED_MOVES. Please update your configuration."
#elif HAS_PID_HEATING && (defined(K1) || !defined(PID_K1))
#error "K1 is now PID_K1. Please update your configuration."
#elif defined(PROBE_DOUBLE_TOUCH)
#error "PROBE_DOUBLE_TOUCH is now MULTIPLE_PROBING. Please update your configuration."
#endif
/**
@ -698,6 +700,10 @@ static_assert(1 >= 0
#error "Probes need Z_CLEARANCE_BETWEEN_PROBES >= 0."
#endif
#if MULTIPLE_PROBING && MULTIPLE_PROBING < 2
#error "MULTIPLE_PROBING must be >= 2."
#endif
#else
/**

Loading…
Cancel
Save