USBSerial: allow CR to terminate lines
authorMichael Moon <triffid.hunter@gmail.com>
Sun, 12 May 2013 02:01:10 +0000 (12:01 +1000)
committerMichael Moon <triffid.hunter@gmail.com>
Sun, 12 May 2013 02:01:10 +0000 (12:01 +1000)
src/libs/USBDevice/USBSerial/USBSerial.cpp

index 1851fa6..28ec811 100644 (file)
@@ -69,7 +69,7 @@ int USBSerial::_getc()
         iprintf("rxbuf has room for another packet, interrupt enabled\n");\r
     }\r
     if (nl_in_rx > 0)\r
-        if (c == '\n')\r
+        if (c == '\n' || c == '\r')\r
             nl_in_rx--;\r
 \r
     return c;\r
@@ -193,7 +193,7 @@ bool USBSerial::USBEvent_EPOut(uint8_t bEP, uint8_t bEPStatus)
         {\r
             iprintf("\\x%02X", c[i]);\r
         }\r
-        if (c[i] == '\n')\r
+        if (c[i] == '\n' || c[i] == '\r')\r
             nl_in_rx++;\r
     }\r
     iprintf("\nQueued, %d empty\n", rxbuf.free());\r
@@ -247,7 +247,7 @@ void USBSerial::on_main_loop(void *argument)
         while (available())\r
         {\r
             char c = _getc();\r
-            if( c == '\n' )\r
+            if( c == '\n' || c == '\r')\r
             {\r
                 struct SerialMessage message;\r
                 message.message = received;\r