From 9e97215e13709b13b8dc7ae6deed6221cca3212b Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 20 Dec 2023 01:46:43 -0800 Subject: [PATCH] can fingerprints comments --- selfdrive/car/chrysler/fingerprints.py | 12 ++++++++++++ selfdrive/debug/format_fingerprints.py | 11 ++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/chrysler/fingerprints.py b/selfdrive/car/chrysler/fingerprints.py index feb6c65a45..bd191aae5d 100644 --- a/selfdrive/car/chrysler/fingerprints.py +++ b/selfdrive/car/chrysler/fingerprints.py @@ -4,6 +4,18 @@ from openpilot.selfdrive.car.chrysler.values import CAR Ecu = car.CarParams.Ecu +# Unique CAN messages: +# Only the hybrids have 270: 8 +# Only the gas have 55: 8, 416: 7 +# For 564, All 2017 have length 4, whereas 2018-19 have length 8. +# For 924, Pacifica 2017 has length 3, whereas all 2018-19 have length 8. +# For 560, All 2019 have length 8, whereas all 2017-18 have length 4. +# +# Jeep Grand Cherokee unique messages: +# 2017 Trailhawk: 618: 8 +# For 924, Trailhawk 2017 has length 3, whereas 2018 V6 has length 8. + + FINGERPRINTS = { CAR.PACIFICA_2017_HYBRID: [ { diff --git a/selfdrive/debug/format_fingerprints.py b/selfdrive/debug/format_fingerprints.py index ade0193ade..af55c984e7 100755 --- a/selfdrive/debug/format_fingerprints.py +++ b/selfdrive/debug/format_fingerprints.py @@ -28,6 +28,7 @@ Ecu = car.CarParams.Ecu {% endif %} {% if FINGERPRINTS[brand] %} +{% if fingerprints_comments %}{{ fingerprints_comments | join() }}\n\n{% endif %} FINGERPRINTS = { {% for car, fingerprints in FINGERPRINTS[brand].items() %} CAR.{{PLATFORM_TO_ENUM_NAME[car]}}: [ @@ -61,9 +62,13 @@ FW_VERSIONS = { def format_brand_fw_versions(brand): - with open(os.path.join(BASEDIR, f"selfdrive/car/{brand}/fingerprints.py"), "w") as f: - f.write(FINGERPRINTS_PY_TEMPLATE.render(brand=brand, ECU_NAME=ECU_NAME, PLATFORM_TO_ENUM_NAME=PLATFORM_TO_ENUM_NAME, - FINGERPRINTS=FINGERPRINTS, FW_VERSIONS=FW_VERSIONS)) + fingerprints_file = os.path.join(BASEDIR, f"selfdrive/car/{brand}/fingerprints.py") + with open(fingerprints_file, "r") as f: + fingerprints_comments = [line for line in f.readlines() if line.startswith("#") and "noqa" not in line] + + 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)) if __name__ == "__main__":