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