mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-13 05:12:11 +08:00
cabana: migrate dbc map (#31920)
* fix cabana * within platform map old-commit-hash: 1f424bf7dcbe13a6a60212816cfd3057da6f5a1f
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from typing import Any, Callable
|
||||
from openpilot.selfdrive.car.interfaces import get_interface_attr
|
||||
from openpilot.selfdrive.car.body.values import CAR as BODY
|
||||
from openpilot.selfdrive.car.chrysler.values import CAR as CHRYSLER
|
||||
@@ -10,6 +11,7 @@ from openpilot.selfdrive.car.nissan.values import CAR as NISSAN
|
||||
from openpilot.selfdrive.car.subaru.values import CAR as SUBARU
|
||||
from openpilot.selfdrive.car.tesla.values import CAR as TESLA
|
||||
from openpilot.selfdrive.car.toyota.values import CAR as TOYOTA
|
||||
from openpilot.selfdrive.car.values import PLATFORMS, Platform
|
||||
from openpilot.selfdrive.car.volkswagen.values import CAR as VW
|
||||
|
||||
FW_VERSIONS = get_interface_attr('FW_VERSIONS', combine_brands=True, ignore_none=True)
|
||||
@@ -336,3 +338,15 @@ MIGRATION = {
|
||||
"SKODA SCALA 1ST GEN": VW.SKODA_SCALA_MK1,
|
||||
"SKODA SUPERB 3RD GEN": VW.SKODA_SUPERB_MK3,
|
||||
}
|
||||
|
||||
|
||||
MapFunc = Callable[[Platform], Any]
|
||||
|
||||
|
||||
def create_platform_map(func: MapFunc):
|
||||
ret = {str(platform): func(platform) for platform in PLATFORMS.values() if func(platform) is not None}
|
||||
|
||||
for m in MIGRATION:
|
||||
ret[m] = ret[MIGRATION[m]]
|
||||
|
||||
return ret
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, cast
|
||||
from typing import cast
|
||||
from openpilot.selfdrive.car.body.values import CAR as BODY
|
||||
from openpilot.selfdrive.car.chrysler.values import CAR as CHRYSLER
|
||||
from openpilot.selfdrive.car.ford.values import CAR as FORD
|
||||
@@ -17,9 +17,3 @@ Platform = BODY | CHRYSLER | FORD | GM | HONDA | HYUNDAI | MAZDA | MOCK | NISSAN
|
||||
BRANDS = [BODY, CHRYSLER, FORD, GM, HONDA, HYUNDAI, MAZDA, MOCK, NISSAN, SUBARU, TESLA, TOYOTA, VOLKSWAGEN]
|
||||
|
||||
PLATFORMS: dict[str, Platform] = {str(platform): platform for brand in BRANDS for platform in cast(list[Platform], brand)}
|
||||
|
||||
MapFunc = Callable[[Platform], Any]
|
||||
|
||||
|
||||
def create_platform_map(func: MapFunc):
|
||||
return {str(platform): func(platform) for platform in PLATFORMS.values() if func(platform) is not None}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import argparse
|
||||
import json
|
||||
|
||||
from openpilot.selfdrive.car.values import create_platform_map
|
||||
from openpilot.selfdrive.car.fingerprints import create_platform_map
|
||||
|
||||
|
||||
def generate_dbc_json() -> str:
|
||||
|
||||
Reference in New Issue
Block a user