Skip to content

Commit

Permalink
Hyundai: add PT queries for all ECUs (#31334)
Browse files Browse the repository at this point in the history
* We never had any bus 0 logging queries for CAN!

* should be logging

* try all, and try on can fd as well

* update refs

* oof forgot about hda2 can fd where pt is bus 1

* sheesh

* fix the timing

* fix ref
  • Loading branch information
sshane authored Feb 7, 2024
1 parent 4ec0ed3 commit bcd29a2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
29 changes: 29 additions & 0 deletions selfdrive/car/hyundai/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ def match_fw_to_car_fuzzy(live_fw_versions, offline_fw_versions) -> Set[str]:
# TODO: there are date codes in the ABS firmware versions in hex
DATE_FW_ECUS = [Ecu.fwdCamera]

ALL_HYUNDAI_ECUS = [Ecu.eps, Ecu.abs, Ecu.fwdRadar, Ecu.fwdCamera, Ecu.engine, Ecu.parkingAdas, Ecu.transmission, Ecu.adas, Ecu.hvac, Ecu.cornerRadar]

FW_QUERY_CONFIG = FwQueryConfig(
requests=[
# TODO: minimize shared whitelists for CAN and cornerRadar for CAN-FD
Expand Down Expand Up @@ -447,6 +449,33 @@ def match_fw_to_car_fuzzy(live_fw_versions, offline_fw_versions) -> Set[str]:
obd_multiplexing=False,
),

# CAN & CAN FD logging queries (from camera)
Request(
[HYUNDAI_VERSION_REQUEST_LONG],
[HYUNDAI_VERSION_RESPONSE],
whitelist_ecus=ALL_HYUNDAI_ECUS,
bus=0,
auxiliary=True,
logging=True,
),
Request(
[HYUNDAI_VERSION_REQUEST_MULTI],
[HYUNDAI_VERSION_RESPONSE],
whitelist_ecus=ALL_HYUNDAI_ECUS,
bus=0,
auxiliary=True,
logging=True,
),
Request(
[HYUNDAI_VERSION_REQUEST_LONG],
[HYUNDAI_VERSION_RESPONSE],
whitelist_ecus=ALL_HYUNDAI_ECUS,
bus=1,
auxiliary=True,
obd_multiplexing=False,
logging=True,
),

# CAN-FD alt request logging queries
Request(
[HYUNDAI_VERSION_REQUEST_ALT],
Expand Down
6 changes: 3 additions & 3 deletions selfdrive/car/tests/test_fw_fingerprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,15 @@ def fake_get_ecu_addrs(*_, timeout):

@pytest.mark.timeout(60)
def test_fw_query_timing(self):
total_ref_time = {1: 5.55, 2: 6.05}
total_ref_time = {1: 5.85, 2: 6.65}
brand_ref_times = {
1: {
'gm': 0.5,
'body': 0.1,
'chrysler': 0.3,
'ford': 0.1,
'honda': 0.55,
'hyundai': 0.65,
'hyundai': 0.95,
'mazda': 0.1,
'nissan': 0.8,
'subaru': 0.45,
Expand All @@ -272,7 +272,7 @@ def test_fw_query_timing(self):
},
2: {
'ford': 0.2,
'hyundai': 1.05,
'hyundai': 1.65,
}
}

Expand Down

0 comments on commit bcd29a2

Please sign in to comment.