chore: Python cleanup
This commit is contained in:
parent
01fbf32042
commit
73a57cb742
2 changed files with 0 additions and 0 deletions
31
python/test.py
Normal file
31
python/test.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
from numpy import uint8
|
||||
|
||||
|
||||
def send_hud(buf: list):
|
||||
n = len(buf)
|
||||
chars = []
|
||||
crc = uint8(0xeb + n + n)
|
||||
chars.append(0x10)
|
||||
chars.append(0x7b)
|
||||
chars.append(n + 6)
|
||||
if n == 0xa:
|
||||
chars.append(0x10)
|
||||
chars.append(n)
|
||||
chars.append(0x00)
|
||||
chars.append(0x00)
|
||||
chars.append(0x00)
|
||||
chars.append(0x55)
|
||||
chars.append(0x15)
|
||||
for char in buf:
|
||||
crc = uint8(crc + char)
|
||||
chars.append(char)
|
||||
if char == 0x10:
|
||||
chars.append(0x10)
|
||||
chars.append((-crc) & 0xff)
|
||||
chars.append(0x10)
|
||||
chars.append(0x03)
|
||||
print(chars)
|
||||
print([bytes(chr(char), 'raw_unicode_escape') for char in chars])
|
||||
|
||||
|
||||
send_hud([0x04, 0x01])
|
Loading…
Add table
Add a link
Reference in a new issue