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

@ -69,6 +69,8 @@
uint8_t xon_xoff_state = XON_XOFF_CHAR_SENT | XON_CHAR;
#endif
void clear_command_queue();
#if ENABLED(SERIAL_STATS_DROPPED_RX)
uint8_t rx_dropped_bytes = 0;
#endif
@ -388,7 +390,8 @@
// reading rx_buffer_head and updating rx_buffer_tail, the previous rx_buffer_head
// may be written to rx_buffer_tail, making the buffer appear full rather than empty.
CRITICAL_SECTION_START;
rx_buffer.head = rx_buffer.tail;
rx_buffer.head = rx_buffer.tail = 0;
clear_command_queue();
CRITICAL_SECTION_END;
#if ENABLED(SERIAL_XON_XOFF)