|
@@ -69,7 +69,7 @@ void GcodeSuite::G29() {
|
69
|
69
|
static bool enable_soft_endstops;
|
70
|
70
|
#endif
|
71
|
71
|
|
72
|
|
- const MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport);
|
|
72
|
+ MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport);
|
73
|
73
|
if (!WITHIN(state, 0, 5)) {
|
74
|
74
|
SERIAL_PROTOCOLLNPGM("S out of range (0-5).");
|
75
|
75
|
return;
|
|
@@ -90,8 +90,11 @@ void GcodeSuite::G29() {
|
90
|
90
|
case MeshStart:
|
91
|
91
|
mbl.reset();
|
92
|
92
|
mbl_probe_index = 0;
|
93
|
|
- enqueue_and_echo_commands_P(lcd_wait_for_move ? PSTR("G29 S2") : PSTR("G28\nG29 S2"));
|
94
|
|
- break;
|
|
93
|
+ if (!lcd_wait_for_move) {
|
|
94
|
+ enqueue_and_echo_commands_P(PSTR("G28\nG29 S2"));
|
|
95
|
+ return;
|
|
96
|
+ }
|
|
97
|
+ state = MeshNext;
|
95
|
98
|
|
96
|
99
|
case MeshNext:
|
97
|
100
|
if (mbl_probe_index < 0) {
|
|
@@ -108,7 +111,7 @@ void GcodeSuite::G29() {
|
108
|
111
|
do_blocking_move_to_z(0);
|
109
|
112
|
}
|
110
|
113
|
else {
|
111
|
|
- // For G29 S2 after adjusting Z.
|
|
114
|
+ // Save Z for the previous mesh position
|
112
|
115
|
mbl.set_zigzag_z(mbl_probe_index - 1, current_position[Z_AXIS]);
|
113
|
116
|
#if HAS_SOFTWARE_ENDSTOPS
|
114
|
117
|
soft_endstops_enabled = enable_soft_endstops;
|
|
@@ -201,7 +204,7 @@ void GcodeSuite::G29() {
|
201
|
204
|
|
202
|
205
|
} // switch(state)
|
203
|
206
|
|
204
|
|
- if (state == MeshStart || state == MeshNext) {
|
|
207
|
+ if (state == MeshNext) {
|
205
|
208
|
SERIAL_PROTOCOLPAIR("MBL G29 point ", min(mbl_probe_index, GRID_MAX_POINTS));
|
206
|
209
|
SERIAL_PROTOCOLLNPAIR(" of ", int(GRID_MAX_POINTS));
|
207
|
210
|
}
|