mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-27 17:42:04 +08:00
nah
This commit is contained in:
@@ -8,7 +8,7 @@ from opendbc.car import gen_empty_fingerprint
|
||||
from opendbc.car.can_definitions import CanRecvCallable, CanSendCallable
|
||||
from opendbc.car.carlog import carlog
|
||||
from opendbc.car.structs import CarParams, CarParamsT
|
||||
from opendbc.car.fingerprints import eliminate_incompatible_cars, exact_fingerprint_matches, all_legacy_fingerprint_cars
|
||||
from opendbc.car.fingerprints import eliminate_incompatible_cars, all_legacy_fingerprint_cars
|
||||
from opendbc.car.fw_versions import ObdCallback, get_fw_versions_ordered, get_present_ecus, match_fw_to_car
|
||||
from opendbc.car.mock.values import CAR as MOCK
|
||||
from opendbc.car.toyota.values import ToyotaSafetyFlags
|
||||
@@ -192,10 +192,6 @@ def can_fingerprint(can_recv: CanRecvCallable) -> tuple[str | None, dict[int, di
|
||||
if len(candidate_cars[b]) == 1 and frame > FRAME_FINGERPRINT:
|
||||
# fingerprint done
|
||||
car_fingerprint = candidate_cars[b][0]
|
||||
elif len(candidate_cars[b]) > 1 and frame > FRAME_FINGERPRINT * 2:
|
||||
exact_matches = exact_fingerprint_matches(finger.get(b, {}), candidate_cars[b])
|
||||
if len(exact_matches) == 1:
|
||||
car_fingerprint = exact_matches[0]
|
||||
|
||||
# bail if no cars left or we've been waiting for more than 2s
|
||||
failed = (all(len(cc) == 0 for cc in candidate_cars.values()) and frame > FRAME_FINGERPRINT) or frame > 200
|
||||
|
||||
@@ -48,13 +48,6 @@ def eliminate_incompatible_cars(msg, candidate_cars):
|
||||
return compatible_cars
|
||||
|
||||
|
||||
def exact_fingerprint_matches(car_fingerprint: dict[int, int], candidate_cars):
|
||||
return [
|
||||
car_name for car_name in candidate_cars
|
||||
if any(car_fingerprint == fingerprint for fingerprint in _FINGERPRINTS[car_name])
|
||||
]
|
||||
|
||||
|
||||
def all_legacy_fingerprint_cars():
|
||||
"""Returns a list of all known car strings, FPv1 only."""
|
||||
return list(_FINGERPRINTS.keys())
|
||||
|
||||
@@ -31,12 +31,6 @@ class TestCanFingerprint:
|
||||
assert finger[1] == fingerprint
|
||||
assert finger[2] == {}
|
||||
|
||||
def test_exact_fingerprint_preferred_over_gm_sascm_superset(self):
|
||||
car_fingerprint, finger = self._fingerprint_from_can(FINGERPRINTS[GM.CADILLAC_ESCALADE_ESV_2019][0])
|
||||
|
||||
assert car_fingerprint == GM.CADILLAC_ESCALADE_ESV_2019
|
||||
assert 0x2FF not in finger[0]
|
||||
|
||||
def test_gm_sascm_superset_fingerprint_matches_ascm_variant(self):
|
||||
car_fingerprint, finger = self._fingerprint_from_can(FINGERPRINTS[GM.CADILLAC_ESCALADE_ESV_2019_ASCM][0])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user