Skip to content

Commit

Permalink
more debugging for weird 255 value
Browse files Browse the repository at this point in the history
  • Loading branch information
bosh committed Dec 12, 2024
1 parent 3595937 commit 1271e58
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mpf/tests/test_Spike.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def read(self, length):
return b''
msg = self.queue.pop()

print("DQ: {msg}")
return msg

def read_ready(self):
Expand All @@ -40,15 +41,19 @@ def write(self, encoded_msg):
self.queue.append(b'MPF Spike Bridge!\r\n')
return len(encoded_msg)
if encoded_msg[0] == 0x00:
print("WR1")
self._handle_msg(encoded_msg[0:1])
encoded_msg = encoded_msg[1:]
elif encoded_msg[0] == 0x01:
print("WR2")
self._handle_msg(encoded_msg[0:2])
encoded_msg = encoded_msg[2:]
elif encoded_msg[0] == 0x80 and encoded_msg[2] == 0x90:
print("WR3")
self._handle_msg(encoded_msg[0:2051])
encoded_msg = encoded_msg[2051:]
else:
print("W4")
msg_len = encoded_msg[1] + 3
self._handle_msg(encoded_msg[0:msg_len])
encoded_msg = encoded_msg[msg_len:]
Expand All @@ -70,6 +75,7 @@ def _handle_msg(self, encoded_msg):

msg = encoded_msg

print("HA: {msg}")
msg = bytes(msg)

if msg and msg[0] & 0x80 and (msg[2] == 0x11 or (msg[2] == 0xf0 and msg[3] == 0x10)):
Expand Down

0 comments on commit 1271e58

Please sign in to comment.