commit
9d52d017df
2 changed files with 10 additions and 10 deletions
|
@ -196,10 +196,6 @@ int MarlinSerial::read(void)
|
||||||
|
|
||||||
void MarlinSerial::flush()
|
void MarlinSerial::flush()
|
||||||
{
|
{
|
||||||
// don't reverse this or there may be problems if the RX interrupt
|
|
||||||
// occurs after reading the value of rx_buffer_head but before writing
|
|
||||||
// the value to rx_buffer_tail; the previous value of rx_buffer_head
|
|
||||||
// may be written to rx_buffer_tail, making it appear as if the buffer
|
|
||||||
// don't reverse this or there may be problems if the RX interrupt
|
// don't reverse this or there may be problems if the RX interrupt
|
||||||
// occurs after reading the value of rx_buffer_head but before writing
|
// occurs after reading the value of rx_buffer_head but before writing
|
||||||
// the value to rx_buffer_tail; the previous value of rx_buffer_head
|
// the value to rx_buffer_tail; the previous value of rx_buffer_head
|
||||||
|
|
|
@ -368,11 +368,15 @@ void get_command()
|
||||||
|
|
||||||
bool rx_buffer_full = false; //flag that serial rx buffer is full
|
bool rx_buffer_full = false; //flag that serial rx buffer is full
|
||||||
|
|
||||||
while (MYSERIAL.available() > 0) {
|
|
||||||
if (MYSERIAL.available() == RX_BUFFER_SIZE - 1) { //compare number of chars buffered in rx buffer with rx buffer size
|
if (MYSERIAL.available() == RX_BUFFER_SIZE - 1) { //compare number of chars buffered in rx buffer with rx buffer size
|
||||||
|
MYSERIAL.flush();
|
||||||
SERIAL_ECHOLNPGM("Full RX Buffer"); //if buffer was full, there is danger that reading of last gcode will not be completed
|
SERIAL_ECHOLNPGM("Full RX Buffer"); //if buffer was full, there is danger that reading of last gcode will not be completed
|
||||||
|
|
||||||
rx_buffer_full = true; //sets flag that buffer was full
|
rx_buffer_full = true; //sets flag that buffer was full
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (MYSERIAL.available() > 0) {
|
||||||
|
|
||||||
char serial_char = MYSERIAL.read();
|
char serial_char = MYSERIAL.read();
|
||||||
/* if (selectedSerialPort == 1)
|
/* if (selectedSerialPort == 1)
|
||||||
{
|
{
|
||||||
|
@ -529,11 +533,11 @@ void get_command()
|
||||||
}
|
}
|
||||||
|
|
||||||
//add comment
|
//add comment
|
||||||
if (rx_buffer_full == true && serial_count > 0) { //if rx buffer was full and string was not properly terminated
|
/*if (rx_buffer_full == true && serial_count > 0) { //if rx buffer was full and string was not properly terminated
|
||||||
rx_buffer_full = false;
|
rx_buffer_full = false;
|
||||||
bufindw = bufindw - serial_count; //adjust tail of the buffer to prepare buffer for writing new command
|
bufindw = bufindw - serial_count; //adjust tail of the buffer to prepare buffer for writing new command
|
||||||
serial_count = 0;
|
serial_count = 0;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if(!card.sdprinting || serial_count!=0){
|
if(!card.sdprinting || serial_count!=0){
|
||||||
|
|
Loading…
Reference in a new issue