Serial buffer over run work around for v2.0.0 (#9236)

* Work around for serial buffer over run

PronterFace sends a lot of M105 commands.  During long operations such
as UBL's G29 P1, G29 P2, G29 P4 and G26 this can over run the serial
buffer.   This results (very often) in a M1 (actually a M1M105) ending
up in the command queue.

Until we figure out a better way to resolve this issue, this will keep
the UBL commands from experiencing bogus commands at thier completion.
This commit is contained in:
Roxy-3D
2018-01-18 19:57:18 -06:00
committed by GitHub
parent 9d0cf02fef
commit bfd9728cf4
7 changed files with 55 additions and 31 deletions

View File

@ -437,6 +437,9 @@ inline bool turn_on_heaters() {
SERIAL_EOL();
}
idle();
MYSERIAL0.flush(); // G26 takes a long time to complete. PronterFace can
// over run the serial character buffer with M105's without
// this fix
}
#if ENABLED(ULTRA_LCD)
}
@ -459,6 +462,10 @@ inline bool turn_on_heaters() {
SERIAL_EOL();
}
idle();
MYSERIAL0.flush(); // G26 takes a long time to complete. PronterFace can
// over run the serial character buffer with M105's without
// this fix
}
#if ENABLED(ULTRA_LCD)
@ -680,12 +687,12 @@ void GcodeSuite::G26() {
set_bed_leveling_enabled(!parser.seen('D'));
if (current_position[Z_AXIS] < Z_CLEARANCE_BETWEEN_PROBES) {
SERIAL_PROTOCOLLNPGM("! move nozzle to Z_CLEARANCE_BETWEEN_PROBES height.");
SERIAL_ECHOLNPAIR(" Z at:", current_position[Z_AXIS]);
// SERIAL_PROTOCOLLNPGM("! move nozzle to Z_CLEARANCE_BETWEEN_PROBES height.");
// SERIAL_ECHOLNPAIR(" Z at:", current_position[Z_AXIS]);
do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
stepper.synchronize();
set_current_from_destination();
SERIAL_ECHOLNPAIR(" Z now at:", current_position[Z_AXIS]);
// SERIAL_ECHOLNPAIR(" Z now at:", current_position[Z_AXIS]);
}
if (turn_on_heaters() != G26_OK) goto LEAVE;
@ -711,14 +718,14 @@ SERIAL_ECHOLNPAIR(" Z now at:", current_position[Z_AXIS]);
// Move nozzle to the specified height for the first layer
set_destination_from_current();
SERIAL_PROTOCOLLNPGM("! moving nozzle to 1st layer height.");
SERIAL_ECHOLNPAIR(" Z1 at:", current_position[Z_AXIS]);
//SERIAL_PROTOCOLLNPGM("! moving nozzle to 1st layer height.");
//SERIAL_ECHOLNPAIR(" Z1 at:", current_position[Z_AXIS]);
destination[Z_AXIS] = g26_layer_height;
move_to(destination, 0.0);
stepper.synchronize();
set_destination_from_current();
SERIAL_ECHOLNPAIR(" Z2 at:", current_position[Z_AXIS]);
//stepper.synchronize();
//set_destination_from_current();
//SERIAL_ECHOLNPAIR(" Z2 at:", current_position[Z_AXIS]);
move_to(destination, g26_ooze_amount);
#if ENABLED(ULTRA_LCD)
@ -823,11 +830,17 @@ SERIAL_ECHOLNPAIR(" Z2 at:", current_position[Z_AXIS]);
//}
print_line_from_here_to_there(rx, ry, g26_layer_height, xe, ye, g26_layer_height);
MYSERIAL0.flush(); // G26 takes a long time to complete. PronterFace can
// over run the serial character buffer with M105's without
// this fix
}
if (look_for_lines_to_connect())
goto LEAVE;
}
MYSERIAL0.flush(); // G26 takes a long time to complete. PronterFace can
// over run the serial character buffer with M105's without
// this fix
} while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0);
LEAVE:

View File

@ -90,8 +90,7 @@ void queue_setup() {
* Clear the Marlin command queue
*/
void clear_command_queue() {
cmd_queue_index_r = cmd_queue_index_w;
commands_in_queue = 0;
cmd_queue_index_r = cmd_queue_index_w = commands_in_queue = 0;
}
/**