mirror of
https://github.com/furrtek/PrecIR.git
synced 2026-03-29 09:50:27 +00:00
Coin cell charge detection bugfix ESL Blaster FW version detection Updated flashtest.py to write nasty frames (DM show debug info permanently)
57 lines
1.4 KiB
Python
57 lines
1.4 KiB
Python
# Allows transmitting raw frames to ESLs
|
|
# 2018 furrtek - furrtek.org
|
|
# See LICENSE
|
|
|
|
# 85 06 C9 00 00 00 00: Blink green LED DM
|
|
|
|
import pr
|
|
import tx
|
|
import sys
|
|
|
|
def usage():
|
|
print("Usage:")
|
|
print("rawcmd.py port barcode type hex count\n")
|
|
print(" port: serial port name (0 for ESL Blaster)")
|
|
print(" barcode: 17-character barcode data, or 0")
|
|
print(" type: DM for graphic ESL, SEG for segment")
|
|
print(" hex: frame data as hex string without first byte and CRC")
|
|
print(" count: number of times the frame is transmitted")
|
|
exit()
|
|
|
|
if len(sys.argv) != 6:
|
|
usage()
|
|
|
|
port = sys.argv[1]
|
|
|
|
# Search for connected ESL Blaster if required
|
|
if (port == "0"):
|
|
blaster_info = tx.search_esl_blaster()
|
|
if (blaster_info[0] == "0"):
|
|
exit()
|
|
|
|
# Get PLID from barcode string
|
|
PLID = pr.get_plid(sys.argv[2])
|
|
|
|
ba = bytearray.fromhex(sys.argv[4])
|
|
|
|
frames = []
|
|
|
|
frame = pr.make_raw_frame(0x85 if (sys.argv[3] == "DM") else 0x84, PLID, ba[0])
|
|
frame.extend(ba[1:])
|
|
pr.terminate_frame(frame, 0, int(sys.argv[5]))
|
|
frames.append(frame)
|
|
|
|
# DEBUG
|
|
f = open("frames.txt", "w")
|
|
for fr in frames:
|
|
for b in fr:
|
|
f.write(format(b, '02X') + " ")
|
|
f.write("\n")
|
|
|
|
# Send data to IR transmitter
|
|
if (port == "0"):
|
|
tx.transmit_esl_blaster(frames, 0, blaster_info[0])
|
|
else:
|
|
tx.transmit_serial(frames, port)
|
|
print("Done.")
|