forked from Trygve/otime
Lagde funksjon for mtr spooling
This commit is contained in:
parent
66ce00d496
commit
7abb532b90
19
mtr.py
Normal file
19
mtr.py
Normal file
@ -0,0 +1,19 @@
|
||||
import otime
|
||||
import serial
|
||||
from time import sleep
|
||||
|
||||
def dump_all(port):
|
||||
mtr = serial.Serial(port, baudrate=9600, timeout=40)
|
||||
# dump all command
|
||||
mtr.write(b'/SA')
|
||||
card_dumps = []
|
||||
sleep(0.4)
|
||||
while mtr.in_waiting > 0:
|
||||
mtr.read_until(expected=b'\xFF\xFF\xFF\xFF')
|
||||
size = mtr.read(size=1)
|
||||
if size == b'\xe6':
|
||||
meat = mtr.read(229)
|
||||
full = b'\xFF\xFF\xFF\xFF' + size + meat
|
||||
card_r = otime.CardDump.from_mtr_bytes(full)
|
||||
card_dumps.append(card_r)
|
||||
return card_dumps
|
Loading…
Reference in New Issue
Block a user