Don't report point 0 in MBL G29

This commit is contained in:
Scott Lahteine 2018-04-20 01:14:50 -05:00
parent 3cf7bac129
commit 65a6a86d19

View file

@ -69,7 +69,7 @@ void GcodeSuite::G29() {
static bool enable_soft_endstops; static bool enable_soft_endstops;
#endif #endif
const MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport); MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport);
if (!WITHIN(state, 0, 5)) { if (!WITHIN(state, 0, 5)) {
SERIAL_PROTOCOLLNPGM("S out of range (0-5)."); SERIAL_PROTOCOLLNPGM("S out of range (0-5).");
return; return;
@ -90,8 +90,11 @@ void GcodeSuite::G29() {
case MeshStart: case MeshStart:
mbl.reset(); mbl.reset();
mbl_probe_index = 0; mbl_probe_index = 0;
enqueue_and_echo_commands_P(lcd_wait_for_move ? PSTR("G29 S2") : PSTR("G28\nG29 S2")); if (!lcd_wait_for_move) {
break; enqueue_and_echo_commands_P(PSTR("G28\nG29 S2"));
return;
}
state = MeshNext;
case MeshNext: case MeshNext:
if (mbl_probe_index < 0) { if (mbl_probe_index < 0) {
@ -108,7 +111,7 @@ void GcodeSuite::G29() {
do_blocking_move_to_z(0); do_blocking_move_to_z(0);
} }
else { else {
// For G29 S2 after adjusting Z. // Save Z for the previous mesh position
mbl.set_zigzag_z(mbl_probe_index - 1, current_position[Z_AXIS]); mbl.set_zigzag_z(mbl_probe_index - 1, current_position[Z_AXIS]);
#if HAS_SOFTWARE_ENDSTOPS #if HAS_SOFTWARE_ENDSTOPS
soft_endstops_enabled = enable_soft_endstops; soft_endstops_enabled = enable_soft_endstops;
@ -201,7 +204,7 @@ void GcodeSuite::G29() {
} // switch(state) } // switch(state)
if (state == MeshStart || state == MeshNext) { if (state == MeshNext) {
SERIAL_PROTOCOLPAIR("MBL G29 point ", min(mbl_probe_index, GRID_MAX_POINTS)); SERIAL_PROTOCOLPAIR("MBL G29 point ", min(mbl_probe_index, GRID_MAX_POINTS));
SERIAL_PROTOCOLLNPAIR(" of ", int(GRID_MAX_POINTS)); SERIAL_PROTOCOLLNPAIR(" of ", int(GRID_MAX_POINTS));
} }