Merge pull request #1349 from msutas/patch-2
Improvement - G29 Option for Not Retracting Servo
This commit is contained in:
commit
5151db5c2f
1 changed files with 43 additions and 11 deletions
|
@ -1150,17 +1150,19 @@ static void retract_z_probe() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Probe bed height at position (x,y), returns the measured z value
|
/// 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
|
// move to right place
|
||||||
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before);
|
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]);
|
do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
|
||||||
|
|
||||||
#ifndef Z_PROBE_SLED
|
#ifndef Z_PROBE_SLED
|
||||||
|
if ((retract_action==0) || (retract_action==1))
|
||||||
engage_z_probe(); // Engage Z Servo endstop if available
|
engage_z_probe(); // Engage Z Servo endstop if available
|
||||||
#endif // Z_PROBE_SLED
|
#endif // Z_PROBE_SLED
|
||||||
run_z_probe();
|
run_z_probe();
|
||||||
float measured_z = current_position[Z_AXIS];
|
float measured_z = current_position[Z_AXIS];
|
||||||
#ifndef Z_PROBE_SLED
|
#ifndef Z_PROBE_SLED
|
||||||
|
if ((retract_action==0) || (retract_action==3))
|
||||||
retract_z_probe();
|
retract_z_probe();
|
||||||
#endif // Z_PROBE_SLED
|
#endif // Z_PROBE_SLED
|
||||||
|
|
||||||
|
@ -1750,7 +1752,22 @@ void process_commands()
|
||||||
z_before = current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS;
|
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;
|
eqnBVector[probePointCounter] = measured_z;
|
||||||
|
|
||||||
|
@ -1781,6 +1798,21 @@ void process_commands()
|
||||||
#else // AUTO_BED_LEVELING_GRID not defined
|
#else // AUTO_BED_LEVELING_GRID not defined
|
||||||
|
|
||||||
// Probe at 3 arbitrary points
|
// Probe at 3 arbitrary points
|
||||||
|
// 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
|
// probe 1
|
||||||
float z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING);
|
float z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING);
|
||||||
|
|
||||||
|
@ -1789,7 +1821,7 @@ void process_commands()
|
||||||
|
|
||||||
// probe 3
|
// 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);
|
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();
|
clean_up_after_endstop_move();
|
||||||
|
|
||||||
set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
|
set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
|
||||||
|
|
Reference in a new issue