|
|
@ -59,7 +59,7 @@ def match_fw_to_car_fuzzy(fw_versions_dict, config, log=True, exclude=None): |
|
|
|
# Getting this exactly right isn't crucial, but excluding camera and radar makes it almost |
|
|
|
# Getting this exactly right isn't crucial, but excluding camera and radar makes it almost |
|
|
|
# impossible to get 3 matching versions, even if two models with shared parts are released at the same |
|
|
|
# impossible to get 3 matching versions, even if two models with shared parts are released at the same |
|
|
|
# time and only one is in our database. |
|
|
|
# time and only one is in our database. |
|
|
|
# exclude_types = [Ecu.fwdCamera, Ecu.fwdRadar, Ecu.eps, Ecu.debug] |
|
|
|
exclude_types = [Ecu.fwdCamera, Ecu.fwdRadar, Ecu.eps, Ecu.debug] |
|
|
|
|
|
|
|
|
|
|
|
# Build lookup table from (addr, sub_addr, fw) to list of candidate cars |
|
|
|
# Build lookup table from (addr, sub_addr, fw) to list of candidate cars |
|
|
|
all_fw_versions = defaultdict(set) |
|
|
|
all_fw_versions = defaultdict(set) |
|
|
@ -77,16 +77,18 @@ def match_fw_to_car_fuzzy(fw_versions_dict, config, log=True, exclude=None): |
|
|
|
if addr[0] not in [Ecu.fwdCamera, Ecu.fwdRadar]: |
|
|
|
if addr[0] not in [Ecu.fwdCamera, Ecu.fwdRadar]: |
|
|
|
continue |
|
|
|
continue |
|
|
|
for f in fws: |
|
|
|
for f in fws: |
|
|
|
all_fw_versions[(addr[1], addr[2], f)].add(candidate) |
|
|
|
if addr[0] not in exclude_types: |
|
|
|
|
|
|
|
all_fw_versions[(addr[1], addr[2], f)].add(candidate) |
|
|
|
|
|
|
|
|
|
|
|
# Add platform codes to lookup dict if config specifies a function |
|
|
|
# Add platform codes to lookup dict if config specifies a function |
|
|
|
if config.fuzzy_get_platform_codes is not None: |
|
|
|
if config.fuzzy_get_platform_codes is not None: |
|
|
|
platform_codes = config.fuzzy_get_platform_codes([f]) |
|
|
|
if addr[0] in config.fuzzy_ecus: |
|
|
|
assert len(platform_codes) < 2 # TODO: remove and test? |
|
|
|
platform_codes = config.fuzzy_get_platform_codes([f]) |
|
|
|
if len(platform_codes) == 1: |
|
|
|
assert len(platform_codes) < 2 # TODO: remove and test? |
|
|
|
print(platform_codes, f) |
|
|
|
if len(platform_codes) == 1: |
|
|
|
platform_code = list(platform_codes)[0] |
|
|
|
print(platform_codes, f) |
|
|
|
all_platform_codes[(addr[1], addr[2], platform_code)].add(candidate) |
|
|
|
platform_code = list(platform_codes)[0] |
|
|
|
|
|
|
|
all_platform_codes[(addr[1], addr[2], platform_code)].add(candidate) |
|
|
|
|
|
|
|
|
|
|
|
print(all_platform_codes) |
|
|
|
print(all_platform_codes) |
|
|
|
match_count = 0 |
|
|
|
match_count = 0 |
|
|
|