Jun-11-2019, 02:49 PM
I think I figured it out. This seems to work with a timeout of 1 second:
b'$PASHR' (6 bytes)
b',MPC,<data><checksum>\r\n$PASHR' (108 bytes)
...
b',MPC,<data><checksum>\r\n' (102 bytes)
(delay)
b'$PASHR' (6 bytes)
The delimiter from the last message in the sequence is chopped off and output at the beginning of the next sequence. I can deal with that.
self.serial.timeout = 1 delimiter = b'$PASHR' if self.serial.in_waiting: message = self.serial.read_until(delimiter) if len(message) > 6: # ignore carryover b'$PASHR' ***process message***When I looked carefully at the variable length returns, I discovered that the message sequence after the first incomplete cycle was:
b'$PASHR' (6 bytes)
b',MPC,<data><checksum>\r\n$PASHR' (108 bytes)
...
b',MPC,<data><checksum>\r\n' (102 bytes)
(delay)
b'$PASHR' (6 bytes)
The delimiter from the last message in the sequence is chopped off and output at the beginning of the next sequence. I can deal with that.