From 2f847a1f3349c81c86f442f710f39ac8749b5387 Mon Sep 17 00:00:00 2001 From: Simen Svale Skogsrud Date: Fri, 2 Jul 2010 23:23:32 +0200 Subject: [PATCH] support both CR and LF and CRLF line termination --- serial_protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serial_protocol.c b/serial_protocol.c index 3e246f1..1557f53 100644 --- a/serial_protocol.c +++ b/serial_protocol.c @@ -50,7 +50,7 @@ void sp_process() char c; while((c = serialRead()) != -1) { - if((c == '\n')) { // Line is complete. Then execute! + if((char_counter > 0) && ((c == '\n') || (c == '\r'))) { // Line is complete. Then execute! line[char_counter] = 0; printString(line); printPgmString(PSTR("\r\n")); gc_execute_line(line);