Make MBL work more like PROBE_MANUALLY

This commit is contained in:
Scott Lahteine
2017-11-27 02:12:29 -06:00
parent 94cb412e45
commit 276271e72f
4 changed files with 69 additions and 129 deletions

View File

@ -41,18 +41,6 @@
// Save 130 bytes with non-duplication of PSTR
void echo_not_entered() { SERIAL_PROTOCOLLNPGM(" not entered."); }
void mesh_probing_done() {
mbl.has_mesh = true;
gcode.home_all_axes();
set_bed_leveling_enabled(true);
#if ENABLED(MESH_G28_REST_ORIGIN)
current_position[Z_AXIS] = Z_MIN_POS;
set_destination_from_current();
buffer_line_to_destination(homing_feedrate(Z_AXIS));
stepper.synchronize();
#endif
}
/**
* G29: Mesh-based Z probe, probes a grid and produces a
* mesh to compensate for variable bed height
@ -102,7 +90,7 @@ void GcodeSuite::G29() {
case MeshStart:
mbl.reset();
mbl_probe_index = 0;
enqueue_and_echo_commands_P(PSTR("G28\nG29 S2"));
enqueue_and_echo_commands_P(lcd_wait_for_move ? PSTR("G29 S2") : PSTR("G28\nG29 S2"));
break;
case MeshNext:
@ -148,7 +136,15 @@ void GcodeSuite::G29() {
SERIAL_PROTOCOLLNPGM("Mesh probing done.");
BUZZ(100, 659);
BUZZ(100, 698);
mesh_probing_done();
mbl.has_mesh = true;
gcode.home_all_axes();
set_bed_leveling_enabled(true);
#if ENABLED(MESH_G28_REST_ORIGIN)
current_position[Z_AXIS] = Z_MIN_POS;
set_destination_from_current();
buffer_line_to_destination(homing_feedrate(Z_AXIS));
stepper.synchronize();
#endif
}
break;
@ -177,9 +173,8 @@ void GcodeSuite::G29() {
return;
}
if (parser.seenval('Z')) {
if (parser.seenval('Z'))
mbl.z_values[px][py] = parser.value_linear_units();
}
else {
SERIAL_CHAR('Z'); echo_not_entered();
return;
@ -187,9 +182,8 @@ void GcodeSuite::G29() {
break;
case MeshSetZOffset:
if (parser.seenval('Z')) {
if (parser.seenval('Z'))
mbl.z_offset = parser.value_linear_units();
}
else {
SERIAL_CHAR('Z'); echo_not_entered();
return;
@ -202,6 +196,11 @@ void GcodeSuite::G29() {
} // switch(state)
if (state == MeshStart || state == MeshNext) {
SERIAL_PROTOCOLPAIR("MBL G29 point ", min(mbl_probe_index, GRID_MAX_POINTS));
SERIAL_PROTOCOLLNPAIR(" of ", int(GRID_MAX_POINTS));
}
report_current_position();
}