Refactor 'accurate' auto bed leveling to use probe_pt()

This commit is contained in:
Gabe Rosenhouse 2014-02-16 10:42:29 -08:00
parent c4fbb44d6d
commit 0f7393a13e

View file

@ -1436,31 +1436,20 @@ void process_commands()
for (int xCount=0; xCount < ACCURATE_BED_LEVELING_POINTS; xCount++) for (int xCount=0; xCount < ACCURATE_BED_LEVELING_POINTS; xCount++)
{ {
float z_before;
if (probePointCounter == 0) if (probePointCounter == 0)
{ {
// raise before probing // raise before probing
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_BEFORE_PROBING); z_before = Z_RAISE_BEFORE_PROBING;
} else } else
{ {
// raise extruder // raise extruder
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], 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);
do_blocking_move_to(xProbe - X_PROBE_OFFSET_FROM_EXTRUDER, yProbe - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]); eqnBVector[probePointCounter] = measured_z;
engage_z_probe(); // Engage Z Servo endstop if available
run_z_probe();
eqnBVector[probePointCounter] = current_position[Z_AXIS];
retract_z_probe();
SERIAL_PROTOCOLPGM("Bed x: ");
SERIAL_PROTOCOL(xProbe);
SERIAL_PROTOCOLPGM(" y: ");
SERIAL_PROTOCOL(yProbe);
SERIAL_PROTOCOLPGM(" z: ");
SERIAL_PROTOCOL(current_position[Z_AXIS]);
SERIAL_PROTOCOLPGM("\n");
eqnAMatrix[probePointCounter + 0*ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS] = xProbe; eqnAMatrix[probePointCounter + 0*ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS] = xProbe;
eqnAMatrix[probePointCounter + 1*ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS] = yProbe; eqnAMatrix[probePointCounter + 1*ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS] = yProbe;