pull/28641/head
Shane Smiskol 2 years ago
parent 03c14e50ff
commit 24bb20d85f
  1. 8
      selfdrive/car/toyota/tests/print_platform_codes.py
  2. 1
      selfdrive/car/toyota/values.py

@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from cereal import car from cereal import car
from openpilot.selfdrive.car.toyota.values import FW_VERSIONS, get_platform_codes from openpilot.selfdrive.car.toyota.values import FW_VERSIONS, PLATFORM_CODE_ECUS, get_platform_codes
Ecu = car.CarParams.Ecu Ecu = car.CarParams.Ecu
ECU_NAME = {v: k for k, v in Ecu.schema.enumerants.items()} ECU_NAME = {v: k for k, v in Ecu.schema.enumerants.items()}
@ -10,12 +10,12 @@ if __name__ == "__main__":
print() print()
print(car_model) print(car_model)
for ecu in sorted(ecus, key=lambda x: int(x[0])): for ecu in sorted(ecus, key=lambda x: int(x[0])):
# if ecu[0] not in PLATFORM_CODE_ECUS: if ecu[0] not in PLATFORM_CODE_ECUS:
# continue continue
platform_codes = get_platform_codes(ecus[ecu]) platform_codes = get_platform_codes(ecus[ecu])
codes = {code for code, _ in platform_codes} codes = {code for code, _ in platform_codes}
dates = {date for _, date in platform_codes if date is not None} dates = {date for _, date in platform_codes if date is not None}
print(f' (Ecu.{ECU_NAME[ecu[0]]}, {hex(ecu[1])}, {ecu[2]}):') print(f' (Ecu.{ECU_NAME[ecu[0]]}, {hex(ecu[1])}, {ecu[2]}):')
print(f' Codes: {codes}') print(f' Codes: {codes}')
print(f' Dates: {dates}') print(f' Versions: {dates}')

@ -354,6 +354,7 @@ LONG_FW_PATTERN = re.compile(b'(?P<part>[A-Z0-9]{5})(?P<platform>[A-Z0-9]{2})(?P
FW_LEN_CODE = re.compile(b'^[\x01-\x05]') # 5 chunks max. highest seen is 3 chunks, 16 bytes each FW_LEN_CODE = re.compile(b'^[\x01-\x05]') # 5 chunks max. highest seen is 3 chunks, 16 bytes each
# 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]
# Some ECUs that use KWP2000 have their FW versions on non-standard data identifiers. # Some ECUs that use KWP2000 have their FW versions on non-standard data identifiers.

Loading…
Cancel
Save