Remove CAN_CANFD_HYBRID from CAN_FD checks

This commit is contained in:
Jason Wen
2024-04-26 12:16:39 -04:00
parent af701aec32
commit a4e4c0ef32
3 changed files with 12 additions and 13 deletions
+7 -7
View File
@@ -8,7 +8,7 @@ from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from openpilot.selfdrive.car.hyundai.hyundaicanfd import CanBus
from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, CAR, DBC, CAN_GEARS, CAMERA_SCC_CAR, \
CANFD_CAR, Buttons, CarControllerParams
CANFD_CAR, Buttons, CarControllerParams, CAN_CANFD_HYBRID_CAR
from openpilot.selfdrive.car.interfaces import CarStateBase
PREV_BUTTON_SAMPLES = 8
@@ -27,7 +27,7 @@ class CarState(CarStateBase):
self.gear_msg_canfd = "GEAR_ALT" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS else \
"GEAR_ALT_2" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS_2 else \
"GEAR_SHIFTER"
if CP.carFingerprint in CANFD_CAR:
if CP.carFingerprint in (CANFD_CAR - CAN_CANFD_HYBRID_CAR):
self.shifter_values = can_define.dv[self.gear_msg_canfd]["GEAR"]
elif self.CP.carFingerprint in CAN_GEARS["use_cluster_gears"]:
self.shifter_values = can_define.dv["CLU15"]["CF_Clu_Gear"]
@@ -53,7 +53,7 @@ class CarState(CarStateBase):
self.params = CarControllerParams(CP)
def update(self, cp, cp_cam):
if self.CP.carFingerprint in CANFD_CAR:
if self.CP.carFingerprint in (CANFD_CAR - CAN_CANFD_HYBRID_CAR):
return self.update_canfd(cp, cp_cam)
ret = car.CarState.new_message()
@@ -145,7 +145,7 @@ class CarState(CarStateBase):
ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear))
if not self.CP.openpilotLongitudinalControl and not (self.CP.flags & HyundaiFlags.CAN_CANFD_HYBRID.value):
if not self.CP.openpilotLongitudinalControl and not (self.CP.flags & HyundaiFlags.CAN_CANFD_HYBRID):
aeb_src = "FCA11" if self.CP.flags & HyundaiFlags.USE_FCA.value else "SCC12"
aeb_sig = "FCA_CmdAct" if self.CP.flags & HyundaiFlags.USE_FCA.value else "AEB_CmdAct"
aeb_warning = cp_cruise.vl[aeb_src]["CF_VSM_Warn"] != 0
@@ -254,7 +254,7 @@ class CarState(CarStateBase):
return ret
def get_can_parser(self, CP):
if CP.carFingerprint in CANFD_CAR:
if CP.carFingerprint in (CANFD_CAR - CAN_CANFD_HYBRID_CAR):
return self.get_can_parser_canfd(CP)
messages = [
@@ -304,12 +304,12 @@ class CarState(CarStateBase):
else:
messages.append(("LVR12", 100))
bus = CanBus(CP).ECAN if CP.flags & HyundaiFlags.CAN_CANFD_HYBRID.value else 0
bus = CanBus(CP).ECAN if CP.flags & HyundaiFlags.CAN_CANFD_HYBRID else 0
return CANParser(DBC[CP.carFingerprint]["pt"], messages, bus)
@staticmethod
def get_cam_can_parser(CP):
if CP.carFingerprint in CANFD_CAR:
if CP.carFingerprint in (CANFD_CAR - CAN_CANFD_HYBRID_CAR):
return CarState.get_cam_can_parser_canfd(CP)
messages = []
+4 -5
View File
@@ -36,14 +36,13 @@ class CarInterface(CarInterfaceBase):
if hda2:
ret.flags |= HyundaiFlags.CANFD_HDA2.value
if candidate in CANFD_CAR:
if candidate in (CANFD_CAR - CAN_CANFD_HYBRID_CAR):
# detect if car is hybrid
if 0x105 in fingerprint[CAN.ECAN]:
ret.flags |= HyundaiFlags.HYBRID.value
elif candidate in EV_CAR:
ret.flags |= HyundaiFlags.EV.value
# detect HDA2 with ADAS Driving ECU
if hda2:
if 0x110 in fingerprint[CAN.CAM]:
ret.flags |= HyundaiFlags.CANFD_HDA2_ALT_STEERING.value
@@ -79,7 +78,7 @@ class CarInterface(CarInterfaceBase):
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
# *** longitudinal control ***
if candidate in CANFD_CAR:
if candidate in (CANFD_CAR - CAN_CANFD_HYBRID_CAR):
ret.longitudinalTuning.kpV = [0.1]
ret.longitudinalTuning.kiV = [0.0]
ret.experimentalLongitudinalAvailable = candidate not in (CANFD_UNSUPPORTED_LONGITUDINAL_CAR | CANFD_RADAR_SCC_CAR)
@@ -98,14 +97,14 @@ class CarInterface(CarInterfaceBase):
ret.longitudinalActuatorDelayUpperBound = 0.5
# *** feature detection ***
if candidate in CANFD_CAR:
if candidate in (CANFD_CAR - CAN_CANFD_HYBRID_CAR):
ret.enableBsm = 0x1e5 in fingerprint[CAN.ECAN]
else:
bus = CAN.ECAN if ret.flags & HyundaiFlags.CAN_CANFD_HYBRID else 0
ret.enableBsm = 0x58b in fingerprint[bus]
# *** panda safety config ***
if candidate in CANFD_CAR:
if candidate in (CANFD_CAR - CAN_CANFD_HYBRID_CAR):
cfgs = [get_safety_config(car.CarParams.SafetyModel.hyundaiCanfd), ]
if CAN.ECAN >= 4:
cfgs.insert(0, get_safety_config(car.CarParams.SafetyModel.noOutput))
+1 -1
View File
@@ -591,7 +591,7 @@ def match_fw_to_car_fuzzy(live_fw_versions, vin, offline_fw_versions) -> set[str
# Non-electric CAN FD platforms often do not have platform code specifiers needed
# to distinguish between hybrid and ICE. All EVs so far are either exclusively
# electric or specify electric in the platform code.
fuzzy_platform_blacklist = {str(c) for c in (CANFD_CAR - EV_CAR - CANFD_FUZZY_WHITELIST)}
fuzzy_platform_blacklist = {str(c) for c in (CANFD_CAR - CAN_CANFD_HYBRID_CAR - EV_CAR - CANFD_FUZZY_WHITELIST)}
candidates: set[str] = set()
for candidate, fws in offline_fw_versions.items():