Merge pull request #1349 from msutas/patch-2
Improvement - G29 Option for Not Retracting Servo
This commit is contained in:
commit
5151db5c2f
|
@ -1150,18 +1150,20 @@ static void retract_z_probe() {
|
|||
}
|
||||
|
||||
/// Probe bed height at position (x,y), returns the measured z value
|
||||
static float probe_pt(float x, float y, float z_before) {
|
||||
static float probe_pt(float x, float y, float z_before, int retract_action=0) {
|
||||
// move to right place
|
||||
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before);
|
||||
do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
|
||||
|
||||
#ifndef Z_PROBE_SLED
|
||||
engage_z_probe(); // Engage Z Servo endstop if available
|
||||
if ((retract_action==0) || (retract_action==1))
|
||||
engage_z_probe(); // Engage Z Servo endstop if available
|
||||
#endif // Z_PROBE_SLED
|
||||
run_z_probe();
|
||||
float measured_z = current_position[Z_AXIS];
|
||||
#ifndef Z_PROBE_SLED
|
||||
retract_z_probe();
|
||||
if ((retract_action==0) || (retract_action==3))
|
||||
retract_z_probe();
|
||||
#endif // Z_PROBE_SLED
|
||||
|
||||
SERIAL_PROTOCOLPGM(MSG_BED);
|
||||
|
@ -1750,7 +1752,22 @@ void process_commands()
|
|||
z_before = current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS;
|
||||
}
|
||||
|
||||
float measured_z = probe_pt(xProbe, yProbe, z_before);
|
||||
float measured_z;
|
||||
//Enhanced G29 - Do not retract servo between probes
|
||||
if (code_seen('E') || code_seen('e') )
|
||||
{
|
||||
if ((yProbe==FRONT_PROBE_BED_POSITION) && (xCount==0))
|
||||
{
|
||||
measured_z = probe_pt(xProbe, yProbe, z_before,1);
|
||||
} else if ((yProbe==FRONT_PROBE_BED_POSITION + (yGridSpacing * (AUTO_BED_LEVELING_GRID_POINTS-1))) && (xCount == AUTO_BED_LEVELING_GRID_POINTS-1))
|
||||
{
|
||||
measured_z = probe_pt(xProbe, yProbe, z_before,3);
|
||||
} else {
|
||||
measured_z = probe_pt(xProbe, yProbe, z_before,2);
|
||||
}
|
||||
} else {
|
||||
measured_z = probe_pt(xProbe, yProbe, z_before);
|
||||
}
|
||||
|
||||
eqnBVector[probePointCounter] = measured_z;
|
||||
|
||||
|
@ -1781,15 +1798,30 @@ void process_commands()
|
|||
#else // AUTO_BED_LEVELING_GRID not defined
|
||||
|
||||
// Probe at 3 arbitrary points
|
||||
// probe 1
|
||||
float z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING);
|
||||
// Enhanced G29
|
||||
|
||||
float z_at_pt_1,z_at_pt_2,z_at_pt_3;
|
||||
|
||||
if (code_seen('E') || code_seen('e') )
|
||||
{
|
||||
// probe 1
|
||||
z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING,1);
|
||||
// probe 2
|
||||
z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS,2);
|
||||
// probe 3
|
||||
z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS,3);
|
||||
}
|
||||
else
|
||||
{
|
||||
// probe 1
|
||||
float z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING);
|
||||
|
||||
// probe 2
|
||||
float z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
|
||||
|
||||
// probe 3
|
||||
float z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
|
||||
// probe 2
|
||||
float z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
|
||||
|
||||
// probe 3
|
||||
float z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
|
||||
}
|
||||
clean_up_after_endstop_move();
|
||||
|
||||
set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
|
||||
|
|
Loading…
Reference in a new issue