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"
LOG = "log"
MEASUREMENT = "meas"
def __str__(self):
return str(self.value)
class ScoutPlugin(shepherd.plugin.Plugin):
@staticmethod

@ -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

Loading…
Cancel
Save