mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-25 07:52:03 +08:00
Move CAN fingerprinting behind community features (#20993)
* Move CAN fingerprinting behind community features * fix typo * fix startup test * fix
This commit is contained in:
@@ -92,11 +92,11 @@ class Controls:
|
||||
sounds_available = HARDWARE.get_sound_card_online()
|
||||
|
||||
car_recognized = self.CP.carName != 'mock'
|
||||
fuzzy_fingerprint = self.CP.fuzzyFingerprint
|
||||
|
||||
# If stock camera is disconnected, we loaded car controls and it's not dashcam mode
|
||||
controller_available = self.CP.enableCamera and self.CI.CC is not None and not passive and not self.CP.dashcamOnly
|
||||
community_feature = self.CP.communityFeature or fuzzy_fingerprint
|
||||
community_feature = self.CP.communityFeature or self.CP.fuzzyFingerprint or \
|
||||
self.CP.fingerprintSource == car.CarParams.FingerprintSource.can
|
||||
community_feature_disallowed = community_feature and (not community_feature_toggle)
|
||||
self.read_only = not car_recognized or not controller_available or \
|
||||
self.CP.dashcamOnly or community_feature_disallowed
|
||||
@@ -145,11 +145,11 @@ class Controls:
|
||||
# TODO: no longer necessary, aside from process replay
|
||||
self.sm['liveParameters'].valid = True
|
||||
|
||||
self.startup_event = get_startup_event(car_recognized, controller_available, fuzzy_fingerprint)
|
||||
self.startup_event = get_startup_event(car_recognized, controller_available, self.CP.fuzzyFingerprint)
|
||||
|
||||
if not sounds_available:
|
||||
self.events.add(EventName.soundsUnavailable, static=True)
|
||||
if community_feature_disallowed:
|
||||
if community_feature_disallowed and car_recognized:
|
||||
self.events.add(EventName.communityFeatureDisallowed, static=True)
|
||||
if not car_recognized:
|
||||
self.events.add(EventName.carUnrecognized, static=True)
|
||||
|
||||
@@ -35,11 +35,8 @@ class TestStartup(unittest.TestCase):
|
||||
# TODO: test EventName.startup for release branches
|
||||
|
||||
# officially supported car
|
||||
(EventName.startupMaster, HYUNDAI.SONATA, False, None),
|
||||
(EventName.startupMaster, HYUNDAI.SONATA, True, None),
|
||||
|
||||
# offically supported car, FW query
|
||||
(EventName.startupMaster, TOYOTA.COROLLA, False, COROLLA_FW_VERSIONS),
|
||||
(EventName.startupMaster, TOYOTA.COROLLA, True, COROLLA_FW_VERSIONS),
|
||||
|
||||
# DSU unplugged
|
||||
(EventName.startupMaster, TOYOTA.COROLLA, True, COROLLA_FW_VERSIONS_NO_DSU),
|
||||
@@ -51,7 +48,7 @@ class TestStartup(unittest.TestCase):
|
||||
|
||||
# dashcamOnly car
|
||||
(EventName.startupNoControl, MAZDA.CX5, True, None),
|
||||
(EventName.startupNoControl, MAZDA.CX5, False, None),
|
||||
(EventName.communityFeatureDisallowed, MAZDA.CX5, False, None),
|
||||
|
||||
# unrecognized car
|
||||
(EventName.startupNoCar, None, True, None),
|
||||
@@ -104,7 +101,7 @@ class TestStartup(unittest.TestCase):
|
||||
else:
|
||||
finger = _FINGERPRINTS[car_model][0]
|
||||
|
||||
for _ in range(500):
|
||||
for _ in range(1000):
|
||||
msgs = [[addr, 0, b'\x00'*length, 0] for addr, length in finger.items()]
|
||||
pm.send('can', can_list_to_can_capnp(msgs))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user