From 2d9a4ad5b276757ca30aeb31936a4d7b6e7a6cad Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Sun, 24 Sep 2023 00:01:17 -0700 Subject: [PATCH] fix logic --- selfdrive/car/toyota/values.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/toyota/values.py b/selfdrive/car/toyota/values.py index 1858b25bf2..89e2d0728f 100644 --- a/selfdrive/car/toyota/values.py +++ b/selfdrive/car/toyota/values.py @@ -280,8 +280,10 @@ def get_platform_codes(fw_versions: List[bytes]) -> Dict[bytes, Set[bytes]]: return dict(codes) -def match_fw_to_car_fuzzy(live_fw_versions, exclude_fw: dict[int, bytes]) -> Set[str]: +def match_fw_to_car_fuzzy(live_fw_versions, exclude_fw: dict[int, bytes] = None) -> Set[str]: candidates = set() + if exclude_fw is None: + exclude_fw = dict() for candidate, fws in FW_VERSIONS.items(): # Keep track of ECUs which pass all checks (platform codes, within sub-version range) @@ -294,7 +296,8 @@ def match_fw_to_car_fuzzy(live_fw_versions, exclude_fw: dict[int, bytes]) -> Set continue # ignore FW if in exclude dict and there's more than one fw - expected_versions = [fw for fw in expected_versions if fw != exclude_fw[ecu[0]] and len(expected_versions) > 1] + expected_versions = [fw for fw in expected_versions if ecu[0] not in exclude_fw or + (fw != exclude_fw[ecu[0]] or len(expected_versions) == 1)] # Expected platform codes & versions expected_platform_codes = get_platform_codes(expected_versions)