From 0edf5a2ab578b491850ef8588b86cde2cb91f5e1 Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Thu, 18 Jan 2018 16:51:27 -0600 Subject: [PATCH] Better handle serial over runs... --- Marlin/MarlinSerial.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Marlin/MarlinSerial.cpp b/Marlin/MarlinSerial.cpp index 91a0eab706..36b8f2bdf5 100644 --- a/Marlin/MarlinSerial.cpp +++ b/Marlin/MarlinSerial.cpp @@ -68,6 +68,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 @@ -386,6 +388,7 @@ // may be written to rx_buffer_tail, making the buffer appear full rather than empty. CRITICAL_SECTION_START; rx_buffer.head = rx_buffer.tail = 0; + clear_command_queue(); CRITICAL_SECTION_END; #if ENABLED(SERIAL_XON_XOFF)