From 7d078fe2e63c4a2fd573978a7cc847787473afa2 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 22 Mar 2019 11:29:02 +0100 Subject: SerialReader: Support both types of serial newlines --- lib/runner.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/runner.py') diff --git a/lib/runner.py b/lib/runner.py index fa08c01..9b95e6b 100644 --- a/lib/runner.py +++ b/lib/runner.py @@ -39,7 +39,12 @@ class SerialReader(serial.threaded.Protocol): str_data = data.decode('UTF-8') self.recv_buf += str_data - lines = self.recv_buf.split("\n\r") + if '\n\r' in self.recv_buf: + lines = self.recv_buf.split('\n\r') + elif '\r\n' in self.recv_buf: + lines = self.recv_buf.split('\r\n') + else: + lines = [] if len(lines) > 1: self.lines.extend(lines[:-1]) self.recv_buf = lines[-1] -- cgit v1.2.3