diff --git a/selfdrive/debug/format_fingerprints.py b/selfdrive/debug/format_fingerprints.py index 8b619f3df9..d80d9dd8cc 100644 --- a/selfdrive/debug/format_fingerprints.py +++ b/selfdrive/debug/format_fingerprints.py @@ -38,7 +38,8 @@ FW_VERSIONS = { {% for car, _ in FW_VERSIONS[brand].items() %} CAR.{{PLATFORM_TO_PYTHON_CAR_NAME[brand][car]}}: { {% for key, fw_versions in FW_VERSIONS[brand][car].items() %} - (Ecu.{{ECU_NUMBER_TO_NAME[key[0]]}}, 0x{{"%0x" | format(key[1] | int)}}, {{key[2]}}): [ + (Ecu.{{ECU_NUMBER_TO_NAME[key[0]]}}, 0x{{"%0x" | format(key[1] | int)}}, \ +{% if key[2] %}0x{{"%0x" | format(key[2] | int)}}{% else %}{{key[2]}}{% endif %}): [ {% for fw_version in fw_versions %} {{fw_version}}, {% endfor %} @@ -50,9 +51,12 @@ FW_VERSIONS = { {% endif %} """ -for brand in FW_VERSIONS.keys(): +def format_brand_fw_versions(brand): with open(f"selfdrive/car/{brand}/fingerprints.py", "w") as f: template = jinja2.Template(FINGERPRINTS_PY_TEMPLATE, trim_blocks=True, lstrip_blocks=True) f.write(template.render(brand=brand, ECU_NUMBER_TO_NAME=ECU_NUMBER_TO_NAME, PLATFORM_TO_PYTHON_CAR_NAME=PLATFORM_TO_PYTHON_CAR_NAME, FINGERPRINTS=FINGERPRINTS, FW_VERSIONS=FW_VERSIONS)) + +for brand in FW_VERSIONS.keys(): + format_brand_fw_versions(brand)