diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 74b2e327df..7865e4c956 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -113,9 +113,13 @@ class CarState(CarStateBase): else: ret.gearShifter = GearShifter.unknown - ret.stockAeb = cp.vl["FCA11"]['FCA_CmdAct'] != 0 - ret.stockFcw = cp.vl["FCA11"]['CF_VSM_Warn'] == 2 - + if self.CP.carFingerprint in FEATURES["use_fca"]: + ret.stockAeb = cp.vl["FCA11"]['FCA_CmdAct'] != 0 + ret.stockFcw = cp.vl["FCA11"]['CF_VSM_Warn'] == 2 + else: + ret.stockAeb = cp.vl["SCC12"]['AEB_CmdAct'] != 0 + ret.stockFcw = cp.vl["SCC12"]['CF_VSM_Warn'] == 2 + ret.leftBlindspot = cp.vl["LCA11"]["CF_Lca_IndLeft"] != 0 ret.rightBlindspot = cp.vl["LCA11"]["CF_Lca_IndRight"] != 0 @@ -174,7 +178,7 @@ class CarState(CarStateBase): ("ESC_Off_Step", "TCS15", 0), ("CF_Lvr_GearInf", "LVR11", 0), # Transmission Gear (0 = N or P, 1-8 = Fwd, 14 = Rev) - + ("CF_Lca_IndLeft", "LCA11", 0), ("CF_Lca_IndRight", "LCA11", 0), @@ -187,9 +191,6 @@ class CarState(CarStateBase): ("SAS_Angle", "SAS11", 0), ("SAS_Speed", "SAS11", 0), - ("FCA_CmdAct", "FCA11", 0), - ("CF_VSM_Warn", "FCA11", 0), - ("MainMode_ACC", "SCC11", 0), ("VSetDis", "SCC11", 0), ("SCCInfoDisplay", "SCC11", 0), @@ -210,7 +211,6 @@ class CarState(CarStateBase): ("SAS11", 100), ("SCC11", 50), ("SCC12", 50), - ("FCA11", 50), ("LCA11", 50), ] @@ -259,6 +259,18 @@ class CarState(CarStateBase): ("LVR12", 100) ] + if CP.carFingerprint in FEATURES["use_fca"]: + signals += [ + ("FCA_CmdAct", "FCA11", 0), + ("CF_VSM_Warn", "FCA11", 0), + ] + checks += [("FCA11", 50)] + else: + signals += [ + ("AEB_CmdAct", "SCC12", 0), + ("CF_VSM_Warn", "SCC12", 0), + ] + return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0) @staticmethod diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 09c70f008c..1e564f377c 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -206,9 +206,13 @@ CHECKSUM = { } FEATURES = { - "use_cluster_gears": [CAR.ELANTRA, CAR.KONA, CAR.ELANTRA_GT_I30], # Use Cluster for Gear Selection, rather than Transmission - "use_tcu_gears": [CAR.KIA_OPTIMA, CAR.SONATA_2019], # Use TCU Message for Gear Selection - "use_elect_gears": [CAR.KIA_OPTIMA_H, CAR.IONIQ_EV_LTD, CAR.KONA_EV, CAR.IONIQ], # Use TCU Message for Gear Selection + # which message has the gear + "use_cluster_gears": [CAR.ELANTRA, CAR.KONA, CAR.ELANTRA_GT_I30], + "use_tcu_gears": [CAR.KIA_OPTIMA, CAR.SONATA_2019], + "use_elect_gears": [CAR.KIA_OPTIMA_H, CAR.IONIQ_EV_LTD, CAR.KONA_EV, CAR.IONIQ], + + # these cars use the FCA11 message for the AEB and FCW signals, all others use SCC12 + "use_fca": [CAR.SONATA, CAR.ELANTRA, CAR.ELANTRA_GT_I30, CAR.KIA_STINGER, CAR.IONIQ, CAR.KONA, CAR.KONA_EV, CAR.KIA_FORTE, CAR.PALISADE], } EV_HYBRID = [CAR.IONIQ_EV_LTD, CAR.IONIQ, CAR.KONA_EV]