remove fuzzy_min_match_count from this pr

pull/26939/head
Shane Smiskol 2 years ago
parent 14114aa72d
commit ce10c6cafe
  1. 2
      selfdrive/car/fw_query_definitions.py
  2. 2
      selfdrive/car/fw_versions.py
  3. 5
      selfdrive/car/tests/test_fw_fingerprint.py

@ -78,8 +78,6 @@ class FwQueryConfig:
# Brand-specific fuzzy fingerprinting config options:
# A function to get unique, platform-specific identification codes for a set of versions
fuzzy_get_platform_codes: Optional[Callable[[List[bytes]], Set[bytes]]] = None
# The minimum number of version matches to fuzzy fingerprint
fuzzy_min_match_count: int = 2
# List of ECUs expected to have platform codes
platform_code_ecus: List[capnp.lib.capnp._EnumModule] = field(default_factory=list)

@ -105,7 +105,7 @@ def match_fw_to_car_fuzzy(fw_versions_dict, config, log=True, exclude=None):
# Note that it is possible to match to a candidate without all its ECUs being present
# if there are enough matches. FIXME: parameterize this or require all ECUs to exist like exact matching
if len(matched_ecus) >= config.fuzzy_min_match_count:
if len(matched_ecus) >= 2:
if log:
cloudlog.error(f"Fingerprinted {candidate} using fuzzy match. {len(matched_ecus)} matching ECUs")
return {candidate}

@ -68,7 +68,7 @@ class TestFwFingerprint(TestFwFingerprintBase):
# Assert no match if there are not enough unique ECUs
unique_ecus = {(f['address'], f['subAddress']) for f in fw}
if len(unique_ecus) < config.fuzzy_min_match_count:
if len(unique_ecus) < 2:
self.assertEqual(len(matches), 0, car_model)
# There won't always be a match due to shared FW, but if there is it should be correct
elif len(matches):
@ -132,11 +132,8 @@ class TestFwFingerprint(TestFwFingerprintBase):
with self.subTest(brand=brand):
if config.fuzzy_get_platform_codes is None:
self.assertEqual(len(config.platform_code_ecus), 0, "Cannot specify platform code ECUs without full config")
self.assertEqual(config.fuzzy_min_match_count, 2, "Cannot override minimum match count without full config")
else:
self.assertGreater(len(config.platform_code_ecus), 0, "Need to specify platform code ECUs")
self.assertEqual(config.fuzzy_min_match_count, len(config.platform_code_ecus),
"Fuzzy ECU match count must equal number of fuzzy ECUs")
# Assert every supported ECU FW version returns one platform code
for fw_by_addr in VERSIONS[brand].values():

Loading…
Cancel
Save