From 91c4b26c443e8eb6f024633b8529114455970fb7 Mon Sep 17 00:00:00 2001 From: novirium Date: Tue, 3 Sep 2019 21:07:38 +0800 Subject: [PATCH] Fix enum return values --- shepherd/plugins/scout/scout.py | 2 ++ shepherd/plugins/scout/tdw.py | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/shepherd/plugins/scout/scout.py b/shepherd/plugins/scout/scout.py index 2f2abfa..ac4f211 100644 --- a/shepherd/plugins/scout/scout.py +++ b/shepherd/plugins/scout/scout.py @@ -39,6 +39,8 @@ class MsgName(Enum): OUT2 = "out2" LOG = "log" MEASUREMENT = "meas" + def __str__(self): + return str(self.value) class ScoutPlugin(shepherd.plugin.Plugin): @staticmethod diff --git a/shepherd/plugins/scout/tdw.py b/shepherd/plugins/scout/tdw.py index d4292e1..48ff197 100644 --- a/shepherd/plugins/scout/tdw.py +++ b/shepherd/plugins/scout/tdw.py @@ -52,6 +52,8 @@ class MessageType(Enum): COMMENT = "#" COMMAND = "!" REQUEST = "?" + def __str__(self): + return str(self.value) class Message(): @@ -239,15 +241,16 @@ class MessageHandler(): Actually send a message pulled from the queue. Only called from the serial_comm thread """ + argstr = "" if len(self._tx_message.arguments) > 0: argstr = ':'+','.join(self._tx_message.arguments) - send_str = F"{self._tx_message.msg_type.value}{self._tx_message.msg_name}{argstr}\n" + send_str = F"{self._tx_message.msg_type}{self._tx_message.msg_name}{argstr}\n" self.port.write(send_str.encode('utf-8')) self._tx_sent_time = time.time() - + print(send_str) # Only keep the current message around if we need to track a response if not self._tx_message.needs_response: self._tx_message = None