Tools: added Hott telemetry

This commit is contained in:
Andrew Tridgell 2020-05-11 17:40:43 +10:00
parent c5acb559ca
commit 300c6349cb
2 changed files with 9 additions and 3 deletions

View File

@ -89,6 +89,7 @@ COMMON_VEHICLE_DEPENDENT_LIBRARIES = [
'AP_ADSB',
'AC_PID',
'AP_SerialLED',
'AP_Hott_Telem',
]
def get_legacy_defines(sketch_name):

View File

@ -38,12 +38,14 @@ def embed_file(out, f, idx, embedded_name, uncompressed):
compressed = tempfile.NamedTemporaryFile()
if uncompressed:
compressed.write(open(f,'rb').read())
# ensure nul termination
if sys.version_info[0] >= 3:
compressed.write(bytearray(0))
nul = bytearray(0)
else:
compressed.write(chr(0))
nul = chr(0)
if contents[-1] != nul:
contents += nul
compressed.write(contents)
else:
# compress it
f = open(compressed.name, "wb")
@ -66,6 +68,9 @@ def create_embedded_h(filename, files, uncompressed=False):
out = open(filename, "wb")
write_encode(out, '''// generated embedded files for AP_ROMFS\n\n''')
# remove duplicates and sort
files = sorted(list(set(files)))
for i in range(len(files)):
(name, filename) = files[i]
if not embed_file(out, filename, i, name, uncompressed):