From 838da992e80808ad396a2a9afe119419935d9b56 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 4 May 2018 12:39:49 -0400 Subject: [PATCH] msgproto: Support sending empty strings from create_message() Signed-off-by: Kevin O'Connor --- klippy/msgproto.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/klippy/msgproto.py b/klippy/msgproto.py index 7e38fe6a..66362e18 100644 --- a/klippy/msgproto.py +++ b/klippy/msgproto.py @@ -251,13 +251,15 @@ class MessageParser: out.append(MESSAGE_SYNC) return ''.join(out) def _parse_buffer(self, value): + if not value: + return [] tval = int(value, 16) out = [] for i in range(len(value) // 2): out.append(tval & 0xff) tval >>= 8 out.reverse() - return ''.join([chr(i) for i in out]) + return out def lookup_command(self, msgformat): parts = msgformat.strip().split() msgname = parts[0]