Repo re-org
This commit is contained in:
parent
312fee491c
commit
50998fcfb9
270 changed files with 9 additions and 9 deletions
30
hardware/fw/reader.py
Normal file
30
hardware/fw/reader.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import struct
|
||||
|
||||
import sqlite3
|
||||
|
||||
import serial
|
||||
from cobs import cobs
|
||||
|
||||
if __name__ == '__main__':
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-b', '--baudrate', type=int, default=250000)
|
||||
parser.add_argument('port')
|
||||
parser.add_argument('dbfile')
|
||||
args = parser.parse_args()
|
||||
|
||||
db = sqlite3.connect(args.db)
|
||||
ser = serial.Serial(args.port, args.baudrate)
|
||||
|
||||
while True:
|
||||
packet = ser.read_until(b'\0')
|
||||
try:
|
||||
packet = cobs.decode(packet)
|
||||
crc, seq, struct.decode('IBxH', packet[:8])
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue