handle empty dict

pull/28386/head
Shane Smiskol 2 years ago
parent eafc848612
commit 1778c82790
  1. 4
      selfdrive/car/fw_query_definitions.py
  2. 4
      selfdrive/car/hyundai/values.py

@ -3,7 +3,7 @@ import capnp
import copy import copy
from dataclasses import dataclass, field from dataclasses import dataclass, field
import struct import struct
from typing import Callable, Dict, List, Optional, Tuple from typing import Callable, Dict, List, Optional, Set, Tuple
import panda.python.uds as uds import panda.python.uds as uds
@ -75,7 +75,7 @@ class FwQueryConfig:
# Ecus added for data collection, not to be fingerprinted on # Ecus added for data collection, not to be fingerprinted on
extra_ecus: List[Tuple[capnp.lib.capnp._EnumModule, int, Optional[int]]] = field(default_factory=list) extra_ecus: List[Tuple[capnp.lib.capnp._EnumModule, int, Optional[int]]] = field(default_factory=list)
# A function that each make can provide to fuzzy fingerprint reliably on that make # A function that each make can provide to fuzzy fingerprint reliably on that make
match_fw_to_car_fuzzy: Optional[Callable] = None match_fw_to_car_fuzzy: Optional[Callable[[Dict[Tuple[int, Optional[int]], List[bytes]]], Set[str]]] = None
def __post_init__(self): def __post_init__(self):
for i in range(len(self.requests)): for i in range(len(self.requests)):

@ -354,8 +354,8 @@ def get_platform_codes(fw_versions):
def match_fw_to_hyundai_fuzzy(fw_versions_dict): def match_fw_to_hyundai_fuzzy(fw_versions_dict):
platform_codes_radar = get_platform_codes(fw_versions_dict[(0x7d0, None)]) platform_codes_radar = get_platform_codes(fw_versions_dict.get((0x7d0, None), {}))
platform_codes_camera = get_platform_codes(fw_versions_dict[(0x7c4, None)]) platform_codes_camera = get_platform_codes(fw_versions_dict.get((0x7c4, None), {}))
if len(platform_codes_radar) != 1 or len(platform_codes_camera) != 1: if len(platform_codes_radar) != 1 or len(platform_codes_camera) != 1:
return set() return set()

Loading…
Cancel
Save