no need for PLATFORM_TO_ENUM_NAME!

pull/30792/head
Shane Smiskol 2 years ago
parent 470cfe2035
commit 6cd39481fc
  1. 7
      selfdrive/debug/format_fingerprints.py

@ -11,7 +11,6 @@ Ecu = car.CarParams.Ecu
CARS = get_interface_attr('CAR')
FW_VERSIONS = get_interface_attr('FW_VERSIONS')
FINGERPRINTS = get_interface_attr('FINGERPRINTS')
PLATFORM_TO_ENUM_NAME = {car.value: car.name for brand in CARS for car in CARS[brand]}
ECU_NAME = {v: k for k, v in Ecu.schema.enumerants.items()}
FINGERPRINTS_PY_TEMPLATE = jinja2.Template("""
@ -31,7 +30,7 @@ Ecu = car.CarParams.Ecu
{% if fingerprints_comments %}{{ fingerprints_comments | join() }}\n\n{% endif %}
FINGERPRINTS = {
{% for car, fingerprints in FINGERPRINTS[brand].items() %}
CAR.{{PLATFORM_TO_ENUM_NAME[car]}}: [
CAR.{{car.name}}: [
{% for fingerprint in fingerprints %}
{
{% for key, value in fingerprint.items() %}{{key}}: {{value}}{% if not loop.last %}, {% endif %}{% endfor %}
@ -45,7 +44,7 @@ FINGERPRINTS = {
FW_VERSIONS = {
{% for car, _ in FW_VERSIONS[brand].items() %}
CAR.{{PLATFORM_TO_ENUM_NAME[car]}}: {
CAR.{{car.name}}: {
{% for key, fw_versions in FW_VERSIONS[brand][car].items() %}
(Ecu.{{ECU_NAME[key[0]]}}, 0x{{"%0x" | format(key[1] | int)}}, \
{% if key[2] %}0x{{"%0x" | format(key[2] | int)}}{% else %}{{key[2]}}{% endif %}): [
@ -68,7 +67,7 @@ def format_brand_fw_versions(brand):
with open(fingerprints_file, "w") as f:
f.write(FINGERPRINTS_PY_TEMPLATE.render(brand=brand, fingerprints_comments=fingerprints_comments, ECU_NAME=ECU_NAME,
PLATFORM_TO_ENUM_NAME=PLATFORM_TO_ENUM_NAME, FINGERPRINTS=FINGERPRINTS, FW_VERSIONS=FW_VERSIONS))
FINGERPRINTS=FINGERPRINTS, FW_VERSIONS=FW_VERSIONS))
if __name__ == "__main__":

Loading…
Cancel
Save