|
@ -392,15 +392,8 @@ inline void get_command() |
|
|
while( !card.eof() && buflen < BUFSIZE) { |
|
|
while( !card.eof() && buflen < BUFSIZE) { |
|
|
int16_t n=card.get(); |
|
|
int16_t n=card.get(); |
|
|
serial_char = (char)n; |
|
|
serial_char = (char)n; |
|
|
// Serial.print((char)serial_char); |
|
|
|
|
|
// Serial.print(" "); |
|
|
|
|
|
// Serial.println((int)serial_count); |
|
|
|
|
|
if(serial_char == '\n' || serial_char == '\r' || serial_char == ':' || serial_count >= (MAX_CMD_SIZE - 1)||n==-1) |
|
|
if(serial_char == '\n' || serial_char == '\r' || serial_char == ':' || serial_count >= (MAX_CMD_SIZE - 1)||n==-1) |
|
|
{ |
|
|
{ |
|
|
// if(serial_char == '\n' || serial_char == '\r' ) |
|
|
|
|
|
// Serial.println("newline or :"); |
|
|
|
|
|
// if(serial_count >= (MAX_CMD_SIZE - 1)) |
|
|
|
|
|
// Serial.println("too long line"); |
|
|
|
|
|
if(card.eof()){ |
|
|
if(card.eof()){ |
|
|
card.sdprinting = false; |
|
|
card.sdprinting = false; |
|
|
SERIAL_PROTOCOLLNPGM("Done printing file"); |
|
|
SERIAL_PROTOCOLLNPGM("Done printing file"); |
|
@ -420,7 +413,6 @@ inline void get_command() |
|
|
comment_mode = false; //for new command |
|
|
comment_mode = false; //for new command |
|
|
if(!serial_count) |
|
|
if(!serial_count) |
|
|
{ |
|
|
{ |
|
|
// Serial.println("empty line"); |
|
|
|
|
|
return; //if empty line |
|
|
return; //if empty line |
|
|
} |
|
|
} |
|
|
cmdbuffer[bufindw][serial_count] = 0; //terminate string |
|
|
cmdbuffer[bufindw][serial_count] = 0; //terminate string |
|
@ -428,8 +420,7 @@ inline void get_command() |
|
|
fromsd[bufindw] = true; |
|
|
fromsd[bufindw] = true; |
|
|
buflen += 1; |
|
|
buflen += 1; |
|
|
bufindw = (bufindw + 1)%BUFSIZE; |
|
|
bufindw = (bufindw + 1)%BUFSIZE; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
serial_count = 0; //clear buffer |
|
|
serial_count = 0; //clear buffer |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|