* chores(flysky): separate AFHDS2A and AFHDS3 into 2 different module type This should allow to remove some of the hacks added earlier. * chore: Add some EL18 CI bits * fix(afhds): cmake defs * fix(ci): add el18 to commit-tests.sh * chore(cpn): separate AFHDS2A and AFHDS3 * chore(cpn): remove binary import of afhds and legacy fxFreq field for afhds3 * fix(cpn): limit available internal afhds protocols to those supported by hardware * chore(cpn): update Flysky int module test * fix(cpn): compile error * fix(cpn): afhds2a max channels * fix: TR_MODULE_PROTOCOLS * enh(cpn): more support for afhds2a and 3 * fix(cpn): rebase compile error * fix(cpn): bit indexes * fix(cpn): emi toString * fix(cpn): limit available internal afhds protocols to those supported by hardware * enh(cpn): add support for Flysky EL18 * fix(cpn): available protocols * fix(cpn): rebase moduledata * chore(cpn): add module fields to model print * Separate AFHDS2A and AFHDS3 UI settings. * Fix AFHDS3 conversion from old subtype value. Fix 'Channel Range' layout on portrait LCD. * Fix name. --------- Co-authored-by: Peter Feerick <peter.feerick@gmail.com> Co-authored-by: elecpower <neilh713@tpg.com.au> Co-authored-by: Phil Mitchell <phil.a.mitchell@gmail.com>
77 lines
2.0 KiB
Python
77 lines
2.0 KiB
Python
#!/usr/bin/python3
|
|
|
|
import argparse
|
|
import datetime
|
|
import os
|
|
from builtins import NotADirectoryError
|
|
import shutil
|
|
import tempfile
|
|
|
|
|
|
boards = {
|
|
"NV14": {
|
|
"PCB": "NV14",
|
|
"DEFAULT_MODE": "1",
|
|
},
|
|
"EL18": {
|
|
"PCB": "NV14",
|
|
"PCBREV": "EL18",
|
|
"DEFAULT_MODE": "1",
|
|
},
|
|
}
|
|
|
|
translations = [
|
|
"EN",
|
|
]
|
|
|
|
|
|
def timestamp():
|
|
return datetime.datetime.now().strftime("%y%m%d")
|
|
|
|
|
|
def build(board, translation, srcdir):
|
|
cmake_options = " ".join(["-D%s=%s" % (key, value) for key, value in boards[board].items()])
|
|
cwd = os.getcwd()
|
|
if not os.path.exists("output"):
|
|
os.mkdir("output")
|
|
path = tempfile.mkdtemp()
|
|
os.chdir(path)
|
|
command = "cmake %s -DTRANSLATIONS=%s %s" % (cmake_options, translation, srcdir)
|
|
print(command)
|
|
os.system(command)
|
|
os.system("make firmware -j16")
|
|
os.chdir(cwd)
|
|
index = 0
|
|
while 1:
|
|
suffix = "" if index == 0 else "_%d" % index
|
|
filename = "output/firmware_%s_%s_%s%s.bin" % (board.lower(), translation.lower(), timestamp(), suffix)
|
|
if not os.path.exists(filename):
|
|
shutil.copy("%s/arm-none-eabi/firmware.bin" % path, filename)
|
|
break
|
|
index += 1
|
|
shutil.rmtree(path)
|
|
|
|
|
|
def dir_path(string):
|
|
if os.path.isdir(string):
|
|
return string
|
|
else:
|
|
raise NotADirectoryError(string)
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description="Build Flysky firmware")
|
|
parser.add_argument("-b", "--boards", action="append", help="Destination boards", required=True)
|
|
parser.add_argument("-t", "--translations", action="append", help="Translations", required=True)
|
|
parser.add_argument("srcdir", type=dir_path)
|
|
|
|
args = parser.parse_args()
|
|
|
|
for board in (boards.keys() if "ALL" in args.boards else args.boards):
|
|
for translation in (translations if "ALL" in args.translations else args.translations):
|
|
build(board, translation, args.srcdir)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|