pull/28641/head
Shane Smiskol 2 years ago
parent 94e7272746
commit 02f3e2ff58
  1. 34
      selfdrive/car/toyota/tests/test_toyota.py
  2. 3
      selfdrive/car/toyota/values.py

@ -115,36 +115,26 @@ class TestToyotaFingerprint(unittest.TestCase):
# # Some examples of valid formats: b"56310-L0010", b"56310L0010", b"56310/M6300" # # Some examples of valid formats: b"56310-L0010", b"56310L0010", b"56310/M6300"
# self.assertTrue(all({b"-" in code for code, _ in codes}), # self.assertTrue(all({b"-" in code for code, _ in codes}),
# f"FW does not have part number: {fw}") # f"FW does not have part number: {fw}")
#
def test_platform_codes_spot_check(self): def test_platform_codes_spot_check(self):
return
# Asserts basic platform code parsing behavior for a few cases # Asserts basic platform code parsing behavior for a few cases
results = get_platform_codes([b'\x018966306L3100\x00\x00\x00\x00']) results = get_platform_codes([b"F152607140\x00\x00\x00\x00\x00\x00"])
self.assertEqual(results, {(b"89663-06", b"L3-100")}) self.assertEqual(results, {(b"F1526-07-1", b"40")})
# Some cameras and all radars do not have dates results = get_platform_codes([b"\x028646F4104100\x00\x00\x00\x008646G5301200\x00\x00\x00\x00"])
results = get_platform_codes([b"\xf1\x00AEhe SCC H-CUP 1.01 1.01 96400-G2000 "]) self.assertEqual(results, {(b"8646F-41-04", b"100")})
self.assertEqual(results, {(b"AEhe-G2000", None)})
results = get_platform_codes([b"\xf1\x00CV1_ RDR ----- 1.00 1.01 99110-CV000 "]) # Short version has no part number
self.assertEqual(results, {(b"CV1-CV000", None)}) results = get_platform_codes([b"\x0235879000\x00\x00\x00\x00\x00\x00\x00\x00A4701000\x00\x00\x00\x00\x00\x00\x00\x00"])
self.assertEqual(results, {(b"35-87", b"9000")})
results = get_platform_codes([ results = get_platform_codes([
b"\xf1\x00DH LKAS 1.1 -150210", b"F152607140\x00\x00\x00\x00\x00\x00",
b"\xf1\x00AEhe SCC H-CUP 1.01 1.01 96400-G2000 ", b"\x028646F4104100\x00\x00\x00\x008646G5301200\x00\x00\x00\x00",
b"\xf1\x00CV1_ RDR ----- 1.00 1.01 99110-CV000 ", b"\x0235879000\x00\x00\x00\x00\x00\x00\x00\x00A4701000\x00\x00\x00\x00\x00\x00\x00\x00",
]) ])
self.assertEqual(results, {(b"DH", b"150210"), (b"AEhe-G2000", None), (b"CV1-CV000", None)}) self.assertEqual(results, {(b"F1526-07-1", b"40"), (b"8646F-41-04", b"100"), (b"35-87", b"9000")})
results = get_platform_codes([
b"\xf1\x00LX2 MFC AT USA LHD 1.00 1.07 99211-S8100 220222",
b"\xf1\x00LX2 MFC AT USA LHD 1.00 1.08 99211-S8100 211103",
b"\xf1\x00ON MFC AT USA LHD 1.00 1.01 99211-S9100 190405",
b"\xf1\x00ON MFC AT USA LHD 1.00 1.03 99211-S9100 190720",
])
self.assertEqual(results, {(b"LX2-S8100", b"220222"), (b"LX2-S8100", b"211103"),
(b"ON-S9100", b"190405"), (b"ON-S9100", b"190720")})
#
def test_fuzzy_excluded_platforms(self): def test_fuzzy_excluded_platforms(self):
# Asserts a list of platforms that will not fuzzy fingerprint with platform codes due to them being shared. # Asserts a list of platforms that will not fuzzy fingerprint with platform codes due to them being shared.
# This list can be shrunk as we combine platforms, detect features, and add the hybrid ECU # This list can be shrunk as we combine platforms, detect features, and add the hybrid ECU

@ -2,7 +2,7 @@ import re
from collections import defaultdict from collections import defaultdict
from dataclasses import dataclass, field from dataclasses import dataclass, field
from enum import Enum, IntFlag from enum import Enum, IntFlag
from typing import Dict, List, Optional, Set, Tuple, Union from typing import Dict, List, Set, Tuple, Union
from cereal import car from cereal import car
from openpilot.common.conversions import Conversions as CV from openpilot.common.conversions import Conversions as CV
@ -357,7 +357,6 @@ FW_LEN_CODE = re.compile(b'^[\x01-\x05]') # 5 chunks max. highest seen is 3 chu
FW_CHUNK_LEN = 16 FW_CHUNK_LEN = 16
# List of ECUs expected to have platform codes # List of ECUs expected to have platform codes
# TODO: use hybrid ECU, splits many similar ICE and hybrid variants
PLATFORM_CODE_ECUS = [Ecu.abs, Ecu.engine, Ecu.eps, Ecu.dsu, Ecu.fwdCamera, Ecu.fwdRadar] PLATFORM_CODE_ECUS = [Ecu.abs, Ecu.engine, Ecu.eps, Ecu.dsu, Ecu.fwdCamera, Ecu.fwdRadar]

Loading…
Cancel
Save