Browse Source

Improvement - G29 Option for Not Retracting Servo

This change introduces an improvement to G29 command on Marlin.

Auto bed leveling operation's reliability is based on the repeatability of the Z-probe switch and the servo. This change introduces an option to G29 command. When the G29 command is sent with an "e" option, during auto bed levelling the servo is not retracted between probes which decreases the bias on auto bed levelling resulting from servo.

G29 command does the auto bed probing as it is.

G29 E command engages the servo on first probing point, probes all points and retracts the servo after probing the last point.

Please comment your opinions, test on your printer and check the code on a programmer's perspective. (I am not a good programmer.)
pull/1/head
msutas 10 years ago
parent
commit
e0beb98fd3
  1. 58
      Marlin/Marlin_main.cpp

58
Marlin/Marlin_main.cpp

@ -1150,18 +1150,20 @@ 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
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 #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
retract_z_probe(); if ((retract_action==0) || (retract_action==3))
retract_z_probe();
#endif // Z_PROBE_SLED #endif // Z_PROBE_SLED
SERIAL_PROTOCOLPGM(MSG_BED); SERIAL_PROTOCOLPGM(MSG_BED);
@ -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==BACK_PROBE_BED_POSITION) && (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,15 +1798,30 @@ 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
// probe 1 // Enhanced G29
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,z_at_pt_2,z_at_pt_3;
// 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); if (code_seen('E') || code_seen('e') )
{
// probe 3 // probe 1
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); 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);
}
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);

Loading…
Cancel
Save