Hyundai CAN FD: detect hybrid (#31237)
* detect can fd hybrid * remove from set * prevent EV & hybrid somehow old-commit-hash: e5a8ddc3d0c5f7df7655409ed8ffae182ec57ab6
This commit is contained in:
@@ -45,13 +45,13 @@ class CarInterface(CarInterfaceBase):
|
||||
hda2 = Ecu.adas in [fw.ecu for fw in car_fw]
|
||||
CAN = CanBus(None, hda2, fingerprint)
|
||||
|
||||
# TODO: detect EV and hybrid
|
||||
if candidate in HYBRID_CAR:
|
||||
ret.flags |= HyundaiFlags.HYBRID.value
|
||||
elif candidate in EV_CAR:
|
||||
ret.flags |= HyundaiFlags.EV.value
|
||||
|
||||
if candidate in CANFD_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]:
|
||||
@@ -69,6 +69,12 @@ class CarInterface(CarInterfaceBase):
|
||||
if candidate not in CANFD_RADAR_SCC_CAR:
|
||||
ret.flags |= HyundaiFlags.CANFD_CAMERA_SCC.value
|
||||
else:
|
||||
# TODO: detect EV and hybrid
|
||||
if candidate in HYBRID_CAR:
|
||||
ret.flags |= HyundaiFlags.HYBRID.value
|
||||
elif candidate in EV_CAR:
|
||||
ret.flags |= HyundaiFlags.EV.value
|
||||
|
||||
# Send LFA message on cars with HDA
|
||||
if 0x485 in fingerprint[2]:
|
||||
ret.flags |= HyundaiFlags.SEND_LFA.value
|
||||
|
||||
@@ -49,6 +49,10 @@ class TestHyundaiFingerprint(unittest.TestCase):
|
||||
for car_model in CANFD_CAR:
|
||||
self.assertNotIn(car_model, can_specific_feature_list, "CAN FD car unexpectedly found in a CAN feature list")
|
||||
|
||||
def test_hybrid_ev_sets(self):
|
||||
self.assertEqual(HYBRID_CAR & EV_CAR, set(), "Shared cars between hybrid and EV")
|
||||
self.assertEqual(CANFD_CAR & HYBRID_CAR, set(), "Hard coding CAN FD cars as hybrid is no longer supported")
|
||||
|
||||
def test_auxiliary_request_ecu_whitelist(self):
|
||||
# Asserts only auxiliary Ecus can exist in database for CAN-FD cars
|
||||
whitelisted_ecus = {ecu for r in FW_QUERY_CONFIG.requests for ecu in r.whitelist_ecus if r.auxiliary}
|
||||
|
||||
@@ -501,10 +501,8 @@ CAMERA_SCC_CAR = {CAR.KONA_EV_2022, }
|
||||
|
||||
# these cars use a different gas signal
|
||||
HYBRID_CAR = {CAR.IONIQ_PHEV, CAR.ELANTRA_HEV_2021, CAR.KIA_NIRO_PHEV, CAR.KIA_NIRO_HEV_2021, CAR.SONATA_HYBRID, CAR.KONA_HEV, CAR.IONIQ,
|
||||
CAR.IONIQ_HEV_2022, CAR.SANTA_FE_HEV_2022, CAR.SANTA_FE_PHEV_2022, CAR.IONIQ_PHEV_2019, CAR.TUCSON_HYBRID_4TH_GEN,
|
||||
CAR.KIA_SPORTAGE_HYBRID_5TH_GEN, CAR.KIA_SORENTO_PHEV_4TH_GEN, CAR.KIA_K5_HEV_2020, CAR.KIA_NIRO_HEV_2ND_GEN,
|
||||
CAR.KIA_SORENTO_HEV_4TH_GEN, CAR.KIA_OPTIMA_H, CAR.KIA_OPTIMA_H_G4_FL, CAR.KIA_K8_HEV_1ST_GEN,
|
||||
CAR.AZERA_HEV_6TH_GEN, CAR.KIA_NIRO_PHEV_2022}
|
||||
CAR.IONIQ_HEV_2022, CAR.SANTA_FE_HEV_2022, CAR.SANTA_FE_PHEV_2022, CAR.IONIQ_PHEV_2019, CAR.KIA_K5_HEV_2020,
|
||||
CAR.KIA_OPTIMA_H, CAR.KIA_OPTIMA_H_G4_FL, CAR.AZERA_HEV_6TH_GEN, CAR.KIA_NIRO_PHEV_2022}
|
||||
|
||||
EV_CAR = {CAR.IONIQ_EV_2020, CAR.IONIQ_EV_LTD, CAR.KONA_EV, CAR.KIA_NIRO_EV, CAR.KIA_NIRO_EV_2ND_GEN, CAR.KONA_EV_2022,
|
||||
CAR.KIA_EV6, CAR.IONIQ_5, CAR.IONIQ_6, CAR.GENESIS_GV60_EV_1ST_GEN, CAR.KONA_EV_2ND_GEN}
|
||||
|
||||
Reference in New Issue
Block a user