mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-03 20:42:09 +08:00
e675c9381f
* return a dict where minor version is not in keys * limit valid chunks to 3 (max seen) * First short version character is always 3 (we were using wrong platform code) * docs updates * not here * fixes for printing new platform code format * ecu notes * notes * platform code tests * no tuple * can visualize the whole thing now * make it clear there's no major versions make it clear there's no major versions * static analysis * two minor versions * fix * not using dsu * comment * comment * comment * forgot this one old-commit-hash: c3d0bf7b5e09de43484613e98a02f2606642bbd0
35 lines
1.3 KiB
Python
Executable File
35 lines
1.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
from collections import defaultdict
|
|
from cereal import car
|
|
from openpilot.selfdrive.car.toyota.values import FW_VERSIONS, PLATFORM_CODE_ECUS, get_platform_codes
|
|
|
|
Ecu = car.CarParams.Ecu
|
|
ECU_NAME = {v: k for k, v in Ecu.schema.enumerants.items()}
|
|
|
|
if __name__ == "__main__":
|
|
parts_for_ecu: dict = defaultdict(set)
|
|
cars_for_code: dict = defaultdict(lambda: defaultdict(set))
|
|
for car_model, ecus in FW_VERSIONS.items():
|
|
print()
|
|
print(car_model)
|
|
for ecu in sorted(ecus, key=lambda x: int(x[0])):
|
|
if ecu[0] not in PLATFORM_CODE_ECUS:
|
|
continue
|
|
|
|
platform_codes = get_platform_codes(ecus[ecu])
|
|
parts_for_ecu[ecu] |= {code.split(b'-')[0] for code in platform_codes if code.count(b'-') > 1}
|
|
for code in platform_codes:
|
|
cars_for_code[ecu][b'-'.join(code.split(b'-')[:2])] |= {car_model}
|
|
print(f' (Ecu.{ECU_NAME[ecu[0]]}, {hex(ecu[1])}, {ecu[2]}):')
|
|
print(f' Codes: {platform_codes}')
|
|
|
|
print('\nECU parts:')
|
|
for ecu, parts in parts_for_ecu.items():
|
|
print(f' (Ecu.{ECU_NAME[ecu[0]]}, {hex(ecu[1])}, {ecu[2]}): {parts}')
|
|
|
|
print('\nCar models vs. platform codes (no major versions):')
|
|
for ecu, codes in cars_for_code.items():
|
|
print(f' (Ecu.{ECU_NAME[ecu[0]]}, {hex(ecu[1])}, {ecu[2]}):')
|
|
for code, cars in codes.items():
|
|
print(f' {code!r}: {sorted(cars)}')
|