parent
							
								
									593b0a50f6
								
							
						
					
					
						commit
						72895af60b
					
				
				 6 changed files with 34 additions and 28 deletions
			
			
		@ -1,30 +1,28 @@ | 
				
			||||
#!/usr/bin/env python3 | 
				
			||||
from collections import defaultdict | 
				
			||||
 | 
				
			||||
from cereal import car | 
				
			||||
from openpilot.selfdrive.car.data_structures import CarParams | 
				
			||||
from openpilot.selfdrive.car.ford.values import get_platform_codes | 
				
			||||
from openpilot.selfdrive.car.ford.fingerprints import FW_VERSIONS | 
				
			||||
 | 
				
			||||
Ecu = car.CarParams.Ecu | 
				
			||||
ECU_NAME = {v: k for k, v in Ecu.schema.enumerants.items()} | 
				
			||||
 | 
				
			||||
Ecu = CarParams.Ecu | 
				
			||||
 | 
				
			||||
if __name__ == "__main__": | 
				
			||||
  cars_for_code: defaultdict = defaultdict(lambda: defaultdict(set)) | 
				
			||||
 | 
				
			||||
  for car_model, ecus in FW_VERSIONS.items(): | 
				
			||||
    print(car_model) | 
				
			||||
    for ecu in sorted(ecus, key=lambda x: int(x[0])): | 
				
			||||
    for ecu in sorted(ecus): | 
				
			||||
      platform_codes = get_platform_codes(ecus[ecu]) | 
				
			||||
      for code in platform_codes: | 
				
			||||
        cars_for_code[ecu][code].add(car_model) | 
				
			||||
 | 
				
			||||
      print(f'  (Ecu.{ECU_NAME[ecu[0]]}, {hex(ecu[1])}, {ecu[2]}):') | 
				
			||||
      print(f'  (Ecu.{ecu[0]}, {hex(ecu[1])}, {ecu[2]}):') | 
				
			||||
      print(f'    Codes: {sorted(platform_codes)}') | 
				
			||||
    print() | 
				
			||||
 | 
				
			||||
  print('\nCar models vs. platform codes:') | 
				
			||||
  for ecu, codes in cars_for_code.items(): | 
				
			||||
    print(f'  (Ecu.{ECU_NAME[ecu[0]]}, {hex(ecu[1])}, {ecu[2]}):') | 
				
			||||
    print(f'  (Ecu.{ecu[0]}, {hex(ecu[1])}, {ecu[2]}):') | 
				
			||||
    for code, cars in codes.items(): | 
				
			||||
      print(f'    {code!r}: {sorted(map(str, cars))}') | 
				
			||||
 | 
				
			||||
@ -1,22 +1,21 @@ | 
				
			||||
#!/usr/bin/env python3 | 
				
			||||
from cereal import car | 
				
			||||
from openpilot.selfdrive.car.data_structures import CarParams | 
				
			||||
from openpilot.selfdrive.car.hyundai.values import PLATFORM_CODE_ECUS, get_platform_codes | 
				
			||||
from openpilot.selfdrive.car.hyundai.fingerprints import FW_VERSIONS | 
				
			||||
 | 
				
			||||
Ecu = car.CarParams.Ecu | 
				
			||||
ECU_NAME = {v: k for k, v in Ecu.schema.enumerants.items()} | 
				
			||||
Ecu = CarParams.Ecu | 
				
			||||
 | 
				
			||||
if __name__ == "__main__": | 
				
			||||
  for car_model, ecus in FW_VERSIONS.items(): | 
				
			||||
    print() | 
				
			||||
    print(car_model) | 
				
			||||
    for ecu in sorted(ecus, key=lambda x: int(x[0])): | 
				
			||||
    for ecu in sorted(ecus): | 
				
			||||
      if ecu[0] not in PLATFORM_CODE_ECUS: | 
				
			||||
        continue | 
				
			||||
 | 
				
			||||
      platform_codes = get_platform_codes(ecus[ecu]) | 
				
			||||
      codes = {code for code, _ in platform_codes} | 
				
			||||
      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[0]}, {hex(ecu[1])}, {ecu[2]}):') | 
				
			||||
      print(f'    Codes: {codes}') | 
				
			||||
      print(f'    Dates: {dates}') | 
				
			||||
 | 
				
			||||
					Loading…
					
					
				
		Reference in new issue