Skip to content

Commit fc359fc

Browse files
committed
Revert "remove toyota can fingerprinting exceptions (#22803)"
This reverts commit d8f5e8b. fix static analysis
1 parent d72b86c commit fc359fc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

selfdrive/car/car_helpers.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ def _get_interface_names() -> Dict[str, List[str]]:
7575
interfaces = load_interfaces(interface_names)
7676

7777

78+
def only_toyota_left(candidate_cars):
79+
return all(("TOYOTA" in c or "LEXUS" in c) for c in candidate_cars) and len(candidate_cars) > 0
80+
81+
7882
# **** for use live only ****
7983
def fingerprint(logcan, sendcan):
8084
fixed_fingerprint = os.environ.get('FINGERPRINT', "")
@@ -134,13 +138,19 @@ def fingerprint(logcan, sendcan):
134138
finger[can.src][can.address] = len(can.dat)
135139

136140
for b in candidate_cars:
141+
# Include bus 2 for toyotas to disambiguate cars using camera messages
142+
# (ideally should be done for all cars but we can't for Honda Bosch)
137143
# Ignore extended messages and VIN query response.
138-
if can.src == b and can.address < 0x800 and can.address not in (0x7df, 0x7e0, 0x7e8):
144+
if (can.src == b or (only_toyota_left(candidate_cars[b]) and can.src == 2)) and \
145+
can.address < 0x800 and can.address not in (0x7df, 0x7e0, 0x7e8):
139146
candidate_cars[b] = eliminate_incompatible_cars(can, candidate_cars[b])
140147

141148
# if we only have one car choice and the time since we got our first
142149
# message has elapsed, exit
143150
for b in candidate_cars:
151+
# Toyota needs higher time to fingerprint, since DSU does not broadcast immediately
152+
if only_toyota_left(candidate_cars[b]):
153+
frame_fingerprint = 100 # 1s
144154
if len(candidate_cars[b]) == 1 and frame > frame_fingerprint:
145155
# fingerprint done
146156
car_fingerprint = candidate_cars[b][0]

0 commit comments

Comments
 (0)