From 208976f397ee119b88b0f73ed29305c0c12960eb Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 7 Jul 2016 20:31:11 +0200 Subject: [PATCH] Ignore extended ASCII characters. These characters have no meaning in the G-code apart from the file names and Marlin does not support such file names anyway. Serial characters with a highest bit set to 1 are generated when the USB cable is unplugged, leading to a hang-up of the print process from an SD card. --- Firmware/Marlin_main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 288d67f1e..cab960767 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1030,6 +1030,12 @@ void get_command() while (MYSERIAL.available() > 0) { char serial_char = MYSERIAL.read(); + if (serial_char < 0) + // Ignore extended ASCII characters. These characters have no meaning in the G-code apart from the file names + // and Marlin does not support such file names anyway. + // Serial characters with a highest bit set to 1 are generated when the USB cable is unplugged, leading + // to a hang-up of the print process from an SD card. + continue; if(serial_char == '\n' || serial_char == '\r' || (serial_char == ':' && comment_mode == false) ||