Fix enum return values

fix-v0.2
Tom Wilson 6 years ago
parent b4e46362ab
commit 91c4b26c44

@ -39,6 +39,8 @@ class MsgName(Enum):
OUT2 = "out2" OUT2 = "out2"
LOG = "log" LOG = "log"
MEASUREMENT = "meas" MEASUREMENT = "meas"
def __str__(self):
return str(self.value)
class ScoutPlugin(shepherd.plugin.Plugin): class ScoutPlugin(shepherd.plugin.Plugin):
@staticmethod @staticmethod

@ -52,6 +52,8 @@ class MessageType(Enum):
COMMENT = "#" COMMENT = "#"
COMMAND = "!" COMMAND = "!"
REQUEST = "?" REQUEST = "?"
def __str__(self):
return str(self.value)
class Message(): class Message():
@ -239,15 +241,16 @@ class MessageHandler():
Actually send a message pulled from the queue. Actually send a message pulled from the queue.
Only called from the serial_comm thread Only called from the serial_comm thread
""" """
argstr = "" argstr = ""
if len(self._tx_message.arguments) > 0: if len(self._tx_message.arguments) > 0:
argstr = ':'+','.join(self._tx_message.arguments) 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.port.write(send_str.encode('utf-8'))
self._tx_sent_time = time.time() self._tx_sent_time = time.time()
print(send_str)
# Only keep the current message around if we need to track a response # Only keep the current message around if we need to track a response
if not self._tx_message.needs_response: if not self._tx_message.needs_response:
self._tx_message = None self._tx_message = None

Loading…
Cancel
Save