ardupilot/libraries/AP_OSD/fonts/mcm2bin.py
cclauss 7291aa0d00 AP_OSD: Simplify with the code enumerate()
* Avoid hardcoding the path to the python executable on the shebang line
* Using __with open() as__ automates file close().
2018-09-08 20:24:42 +10:00

18 lines
367 B
Python
Executable File

#!/usr/bin/env python
import sys
if len(sys.argv) < 3:
print("Usage: ./mcm2bin.py clarity.mcm clarity.bin")
exit()
with open(sys.argv[1]) as inp:
content = inp.readlines()
content.pop(0)
with open(sys.argv[2], 'wb') as out:
for i, line in enumerate(content):
if i % 64 < 54:
b = int(line, 2)
out.write(bytearray([b]))