FPv2: rename live FW versions dict (#28550)

rename
pull/214/head
Shane Smiskol 2 years ago committed by GitHub
parent a1b6697629
commit e771660fa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      selfdrive/car/fw_versions.py

@ -54,7 +54,7 @@ def get_brand_addrs() -> Dict[str, Set[Tuple[int, Optional[int]]]]:
return dict(brand_addrs) return dict(brand_addrs)
def match_fw_to_car_fuzzy(fw_versions_dict, log=True, exclude=None): def match_fw_to_car_fuzzy(live_fw_versions, log=True, exclude=None):
"""Do a fuzzy FW match. This function will return a match, and the number of firmware version """Do a fuzzy FW match. This function will return a match, and the number of firmware version
that were matched uniquely to that specific car. If multiple ECUs uniquely match to different cars that were matched uniquely to that specific car. If multiple ECUs uniquely match to different cars
the match is rejected.""" the match is rejected."""
@ -77,7 +77,7 @@ def match_fw_to_car_fuzzy(fw_versions_dict, log=True, exclude=None):
matched_ecus = set() matched_ecus = set()
candidate = None candidate = None
for addr, versions in fw_versions_dict.items(): for addr, versions in live_fw_versions.items():
ecu_key = (addr[0], addr[1]) ecu_key = (addr[0], addr[1])
for version in versions: for version in versions:
# All cars that have this FW response on the specified address # All cars that have this FW response on the specified address
@ -101,7 +101,7 @@ def match_fw_to_car_fuzzy(fw_versions_dict, log=True, exclude=None):
return set() return set()
def match_fw_to_car_exact(fw_versions_dict, log=True) -> Set[str]: def match_fw_to_car_exact(live_fw_versions, log=True) -> Set[str]:
"""Do an exact FW match. Returns all cars that match the given """Do an exact FW match. Returns all cars that match the given
FW versions for a list of "essential" ECUs. If an ECU is not considered FW versions for a list of "essential" ECUs. If an ECU is not considered
essential the FW version can be missing to get a fingerprint, but if it's present it essential the FW version can be missing to get a fingerprint, but if it's present it
@ -115,7 +115,7 @@ def match_fw_to_car_exact(fw_versions_dict, log=True) -> Set[str]:
ecu_type = ecu[0] ecu_type = ecu[0]
addr = ecu[1:] addr = ecu[1:]
found_versions = fw_versions_dict.get(addr, set()) found_versions = live_fw_versions.get(addr, set())
if not len(found_versions): if not len(found_versions):
# Some models can sometimes miss an ecu, or show on two different addresses # Some models can sometimes miss an ecu, or show on two different addresses
if candidate in config.non_essential_ecus.get(ecu_type, []): if candidate in config.non_essential_ecus.get(ecu_type, []):

Loading…
Cancel
Save