From 73274dd93e83dd78016d50d0fd60d621461dc330 Mon Sep 17 00:00:00 2001 From: royjr Date: Wed, 27 Nov 2024 12:25:49 -0500 Subject: [PATCH 01/23] init --- opendbc/car/hyundai/fingerprints.py | 14 ++++++++++++++ opendbc/car/hyundai/hyundaican.py | 2 +- opendbc/car/hyundai/values.py | 5 +++++ opendbc/car/torque_data/substitute.toml | 1 + opendbc/dbc/hyundai_kia_generic.dbc | 2 +- 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index 86c1d87bc5c..35b2e9fcc25 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -887,6 +887,20 @@ b'\xf1\x00CN ESC \t 105 \x10\x03 58910-AA800', ], }, + CAR.HYUNDAI_ELANTRA_2024: { + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00CN7_ RDR ----- 1.00 1.01 99110-AA500 ', + ], + (Ecu.eps, 0x7d4, None): [ + b'\xf1\x00CN7 MDPS C 1.00 1.02 56300AA670\x00 4CSDC102', + ], + (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00CN7 MFC AT USA LHD 1.00 1.02 99210-AA500 230420', + ], + (Ecu.abs, 0x7d1, None): [ + b'\xf1\x00CN ESC \t 104#\x07\x03 58910-AA850', + ], + }, CAR.HYUNDAI_ELANTRA_HEV_2021: { (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00CN7HMFC AT USA LHD 1.00 1.03 99210-AA000 200819', diff --git a/opendbc/car/hyundai/hyundaican.py b/opendbc/car/hyundai/hyundaican.py index 644de8148ab..3a7a6a6613d 100644 --- a/opendbc/car/hyundai/hyundaican.py +++ b/opendbc/car/hyundai/hyundaican.py @@ -38,7 +38,7 @@ def create_lkas11(packer, frame, CP, apply_steer, steer_req, CAR.HYUNDAI_ELANTRA_HEV_2021, CAR.HYUNDAI_SONATA_HYBRID, CAR.HYUNDAI_KONA_EV, CAR.HYUNDAI_KONA_HEV, CAR.HYUNDAI_KONA_EV_2022, CAR.HYUNDAI_SANTA_FE_2022, CAR.KIA_K5_2021, CAR.HYUNDAI_IONIQ_HEV_2022, CAR.HYUNDAI_SANTA_FE_HEV_2022, CAR.HYUNDAI_SANTA_FE_PHEV_2022, CAR.KIA_STINGER_2022, CAR.KIA_K5_HEV_2020, CAR.KIA_CEED, - CAR.HYUNDAI_AZERA_6TH_GEN, CAR.HYUNDAI_AZERA_HEV_6TH_GEN, CAR.HYUNDAI_CUSTIN_1ST_GEN): + CAR.HYUNDAI_AZERA_6TH_GEN, CAR.HYUNDAI_AZERA_HEV_6TH_GEN, CAR.HYUNDAI_CUSTIN_1ST_GEN, CAR.HYUNDAI_ELANTRA_2024): values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) values["CF_Lkas_LdwsOpt_USM"] = 2 diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 223eb97a3dc..a51878ddea3 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -172,6 +172,11 @@ class CAR(Platforms): CarSpecs(mass=2800 * CV.LB_TO_KG, wheelbase=2.72, steerRatio=12.9, tireStiffnessFactor=0.65), flags=HyundaiFlags.CHECKSUM_CRC8, ) + HYUNDAI_ELANTRA_2024 = HyundaiPlatformConfig( + [HyundaiCarDocs("Hyundai Elantra 2024-25", car_parts=CarParts.common([CarHarness.hyundai_k]))], + CarSpecs(mass=2800 * CV.LB_TO_KG, wheelbase=2.72, steerRatio=12.9, tireStiffnessFactor=0.65), + flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.CAMERA_SCC, + ) HYUNDAI_ELANTRA_HEV_2021 = HyundaiPlatformConfig( [HyundaiCarDocs("Hyundai Elantra Hybrid 2021-23", video_link="https://youtu.be/_EdYQtV52-c", car_parts=CarParts.common([CarHarness.hyundai_k]))], diff --git a/opendbc/car/torque_data/substitute.toml b/opendbc/car/torque_data/substitute.toml index 456f823dfa2..1ccaa99bce0 100644 --- a/opendbc/car/torque_data/substitute.toml +++ b/opendbc/car/torque_data/substitute.toml @@ -35,6 +35,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "HYUNDAI_IONIQ_HEV_2022" = "HYUNDAI_IONIQ_PHEV_2019" "HYUNDAI_IONIQ_EV_2020" = "HYUNDAI_IONIQ_PHEV_2019" "HYUNDAI_ELANTRA" = "HYUNDAI_SONATA_LF" +"HYUNDAI_ELANTRA_2024" = "HYUNDAI_ELANTRA_2021" "HYUNDAI_ELANTRA_GT_I30" = "HYUNDAI_SONATA_LF" "HYUNDAI_ELANTRA_HEV_2021" = "HYUNDAI_SONATA" "HYUNDAI_TUCSON" = "HYUNDAI_SANTA_FE" diff --git a/opendbc/dbc/hyundai_kia_generic.dbc b/opendbc/dbc/hyundai_kia_generic.dbc index c828d33c2f0..1638a91c226 100644 --- a/opendbc/dbc/hyundai_kia_generic.dbc +++ b/opendbc/dbc/hyundai_kia_generic.dbc @@ -1481,7 +1481,7 @@ BO_ 905 SCC14: 8 SCC SG_ ACCMode : 32|3@1+ (1,0) [0|7] "" CLU,HUD,LDWS_LKAS,ESC SG_ ObjGap : 56|8@1+ (1,0) [0|255] "" CLU,HUD,ESC -BO_ 1157 LFAHDA_MFC: 4 XXX +BO_ 1157 LFAHDA_MFC: 8 XXX SG_ HDA_USM : 0|2@1+ (1,0) [0|3] "" XXX SG_ HDA_Active : 2|1@1+ (1,0) [0|1] "" XXX SG_ HDA_Icon_State : 3|2@1+ (1,0) [0|3] "" XXX From 4b327ea19c066845feb8182f7d9a254fe0d9104f Mon Sep 17 00:00:00 2001 From: royjr Date: Wed, 27 Nov 2024 12:29:26 -0500 Subject: [PATCH 02/23] dummy route --- opendbc/car/tests/routes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index 2e1eca29a0d..87242016704 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -178,6 +178,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("c5ac319aa9583f83|2021-06-01--18-18-31", HYUNDAI.HYUNDAI_ELANTRA), CarTestRoute("734ef96182ddf940|2022-10-02--16-41-44", HYUNDAI.HYUNDAI_ELANTRA_GT_I30), CarTestRoute("82e9cdd3f43bf83e|2021-05-15--02-42-51", HYUNDAI.HYUNDAI_ELANTRA_2021), + CarTestRoute("test", HYUNDAI.HYUNDAI_ELANTRA_2024), CarTestRoute("715ac05b594e9c59|2021-06-20--16-21-07", HYUNDAI.HYUNDAI_ELANTRA_HEV_2021), CarTestRoute("7120aa90bbc3add7|2021-08-02--07-12-31", HYUNDAI.HYUNDAI_SONATA_HYBRID), CarTestRoute("715ac05b594e9c59|2021-10-27--23-24-56", HYUNDAI.GENESIS_G70_2020), From 1c88173fe7bdb62555e603fe155c132cbca8647d Mon Sep 17 00:00:00 2001 From: royjr Date: Wed, 27 Nov 2024 12:57:36 -0500 Subject: [PATCH 03/23] Update fingerprints.py --- opendbc/car/hyundai/fingerprints.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index 35b2e9fcc25..a60df0d1610 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -892,9 +892,12 @@ b'\xf1\x00CN7_ RDR ----- 1.00 1.01 99110-AA500 ', ], (Ecu.eps, 0x7d4, None): [ + b'\xf1\x00CN7 MDPS C 1.00 1.00 56300BY670\x00 4CSHC100', b'\xf1\x00CN7 MDPS C 1.00 1.02 56300AA670\x00 4CSDC102', ], (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00CN7HMFC AT CAN LHD 1.00 1.05 99210-AA510 240509', + b'\xf1\x00CN7HMFC AT USA LHD 1.00 1.03 99210-AA500 230918', b'\xf1\x00CN7 MFC AT USA LHD 1.00 1.02 99210-AA500 230420', ], (Ecu.abs, 0x7d1, None): [ From ffafb007dfc159bd07c606cace9fb21360a698e4 Mon Sep 17 00:00:00 2001 From: royjr Date: Wed, 27 Nov 2024 14:19:07 -0500 Subject: [PATCH 04/23] remove non-ice fp --- opendbc/car/hyundai/fingerprints.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index a60df0d1610..35b2e9fcc25 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -892,12 +892,9 @@ b'\xf1\x00CN7_ RDR ----- 1.00 1.01 99110-AA500 ', ], (Ecu.eps, 0x7d4, None): [ - b'\xf1\x00CN7 MDPS C 1.00 1.00 56300BY670\x00 4CSHC100', b'\xf1\x00CN7 MDPS C 1.00 1.02 56300AA670\x00 4CSDC102', ], (Ecu.fwdCamera, 0x7c4, None): [ - b'\xf1\x00CN7HMFC AT CAN LHD 1.00 1.05 99210-AA510 240509', - b'\xf1\x00CN7HMFC AT USA LHD 1.00 1.03 99210-AA500 230918', b'\xf1\x00CN7 MFC AT USA LHD 1.00 1.02 99210-AA500 230420', ], (Ecu.abs, 0x7d1, None): [ From 1558b73d50b70148f0a43637c4b8b34a1c03e92c Mon Sep 17 00:00:00 2001 From: royjr Date: Wed, 27 Nov 2024 15:16:26 -0500 Subject: [PATCH 05/23] Update values.py --- opendbc/car/hyundai/values.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index a51878ddea3..605937b6759 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -174,7 +174,7 @@ class CAR(Platforms): ) HYUNDAI_ELANTRA_2024 = HyundaiPlatformConfig( [HyundaiCarDocs("Hyundai Elantra 2024-25", car_parts=CarParts.common([CarHarness.hyundai_k]))], - CarSpecs(mass=2800 * CV.LB_TO_KG, wheelbase=2.72, steerRatio=12.9, tireStiffnessFactor=0.65), + CarSpecs(mass=2797 * CV.LB_TO_KG, wheelbase=2.72, steerRatio=12.9, tireStiffnessFactor=0.65), flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.CAMERA_SCC, ) HYUNDAI_ELANTRA_HEV_2021 = HyundaiPlatformConfig( From b8c2b323df9bedf71a8da66afae2906927414e61 Mon Sep 17 00:00:00 2001 From: royjr Date: Tue, 3 Dec 2024 01:16:19 -0500 Subject: [PATCH 06/23] Update routes.py --- opendbc/car/tests/routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index 87242016704..10b23eeccac 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -178,7 +178,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("c5ac319aa9583f83|2021-06-01--18-18-31", HYUNDAI.HYUNDAI_ELANTRA), CarTestRoute("734ef96182ddf940|2022-10-02--16-41-44", HYUNDAI.HYUNDAI_ELANTRA_GT_I30), CarTestRoute("82e9cdd3f43bf83e|2021-05-15--02-42-51", HYUNDAI.HYUNDAI_ELANTRA_2021), - CarTestRoute("test", HYUNDAI.HYUNDAI_ELANTRA_2024), + CarTestRoute("c2fd040a5e34f3ad/00000013--9211a52a3d", HYUNDAI.HYUNDAI_ELANTRA_2024), CarTestRoute("715ac05b594e9c59|2021-06-20--16-21-07", HYUNDAI.HYUNDAI_ELANTRA_HEV_2021), CarTestRoute("7120aa90bbc3add7|2021-08-02--07-12-31", HYUNDAI.HYUNDAI_SONATA_HYBRID), CarTestRoute("715ac05b594e9c59|2021-10-27--23-24-56", HYUNDAI.GENESIS_G70_2020), From 0a8eed5b0a92a1d59512077af2527bb22e20342b Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 20 Feb 2025 16:18:42 -0500 Subject: [PATCH 07/23] Update safety_hyundai.h --- opendbc/safety/safety/safety_hyundai.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opendbc/safety/safety/safety_hyundai.h b/opendbc/safety/safety/safety_hyundai.h index cf73afee621..e69a86369f0 100644 --- a/opendbc/safety/safety/safety_hyundai.h +++ b/opendbc/safety/safety/safety_hyundai.h @@ -29,7 +29,7 @@ const LongitudinalLimits HYUNDAI_LONG_LIMITS = { static const CanMsg HYUNDAI_TX_MSGS[] = { {0x340, 0, 8}, // LKAS11 Bus 0 {0x4F1, 0, 4}, // CLU11 Bus 0 - {0x485, 0, 4}, // LFAHDA_MFC Bus 0 + {0x485, 0, 8}, // LFAHDA_MFC Bus 0 }; #define HYUNDAI_COMMON_RX_CHECKS(legacy) \ @@ -270,7 +270,7 @@ static safety_config hyundai_init(uint16_t param) { static const CanMsg HYUNDAI_LONG_TX_MSGS[] = { {0x340, 0, 8}, // LKAS11 Bus 0 {0x4F1, 0, 4}, // CLU11 Bus 0 - {0x485, 0, 4}, // LFAHDA_MFC Bus 0 + {0x485, 0, 8}, // LFAHDA_MFC Bus 0 {0x420, 0, 8}, // SCC11 Bus 0 {0x421, 0, 8}, // SCC12 Bus 0 {0x50A, 0, 8}, // SCC13 Bus 0 @@ -284,7 +284,7 @@ static safety_config hyundai_init(uint16_t param) { static const CanMsg HYUNDAI_CAMERA_SCC_TX_MSGS[] = { {0x340, 0, 8}, // LKAS11 Bus 0 {0x4F1, 2, 4}, // CLU11 Bus 2 - {0x485, 0, 4}, // LFAHDA_MFC Bus 0 + {0x485, 0, 8}, // LFAHDA_MFC Bus 0 }; hyundai_common_init(param); From 12a5951cd3bf8ebeb20bcadc530585759f346c5c Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 24 Feb 2025 00:54:37 -0500 Subject: [PATCH 08/23] new line --- opendbc/car/hyundai/hyundaican.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/hyundaican.py b/opendbc/car/hyundai/hyundaican.py index 28b7bf75351..7d7d97ab6b1 100644 --- a/opendbc/car/hyundai/hyundaican.py +++ b/opendbc/car/hyundai/hyundaican.py @@ -38,7 +38,8 @@ def create_lkas11(packer, frame, CP, apply_steer, steer_req, CAR.HYUNDAI_ELANTRA_HEV_2021, CAR.HYUNDAI_SONATA_HYBRID, CAR.HYUNDAI_KONA_EV, CAR.HYUNDAI_KONA_HEV, CAR.HYUNDAI_KONA_EV_2022, CAR.HYUNDAI_SANTA_FE_2022, CAR.KIA_K5_2021, CAR.HYUNDAI_IONIQ_HEV_2022, CAR.HYUNDAI_SANTA_FE_HEV_2022, CAR.HYUNDAI_SANTA_FE_PHEV_2022, CAR.KIA_STINGER_2022, CAR.KIA_K5_HEV_2020, CAR.KIA_CEED, - CAR.HYUNDAI_AZERA_6TH_GEN, CAR.HYUNDAI_AZERA_HEV_6TH_GEN, CAR.HYUNDAI_CUSTIN_1ST_GEN, CAR.HYUNDAI_KONA_2022, CAR.HYUNDAI_ELANTRA_2024): + CAR.HYUNDAI_AZERA_6TH_GEN, CAR.HYUNDAI_AZERA_HEV_6TH_GEN, CAR.HYUNDAI_CUSTIN_1ST_GEN, CAR.HYUNDAI_KONA_2022, + CAR.HYUNDAI_ELANTRA_2024): values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) values["CF_Lkas_LdwsOpt_USM"] = 2 From 7ab3c7c00509e48156aca9117fa4158fe9210fc9 Mon Sep 17 00:00:00 2001 From: royjr Date: Tue, 11 Mar 2025 18:25:06 -0400 Subject: [PATCH 09/23] merge HYUNDAI_ELANTRA_HEV_2024 --- opendbc/car/hyundai/fingerprints.py | 12 ++++++++++++ opendbc/car/hyundai/hyundaican.py | 2 +- opendbc/car/hyundai/values.py | 5 +++++ opendbc/car/tests/routes.py | 1 + opendbc/car/torque_data/substitute.toml | 1 + 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index b7839bb9ad0..f142281ca1b 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -937,6 +937,18 @@ b'\xf1\x00CN7 MDPS C 1.00 1.04 56310BY050\x00 4CNHC104', ], }, + CAR.HYUNDAI_ELANTRA_HEV_2024: { + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00CN7_ RDR ----- 1.00 1.01 99110-AA500 ', + ], + (Ecu.eps, 0x7d4, None): [ + b'\xf1\x00CN7 MDPS C 1.00 1.00 56300BY670\x00 4CSHC100', + ], + (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00CN7HMFC AT CAN LHD 1.00 1.05 99210-AA510 240509', + b'\xf1\x00CN7HMFC AT USA LHD 1.00 1.03 99210-AA500 230918', + ], + }, CAR.HYUNDAI_KONA_HEV: { (Ecu.abs, 0x7d1, None): [ b'\xf1\x00OS IEB \x01 104 \x11 58520-CM000', diff --git a/opendbc/car/hyundai/hyundaican.py b/opendbc/car/hyundai/hyundaican.py index 07c65e3584e..2f14b302873 100644 --- a/opendbc/car/hyundai/hyundaican.py +++ b/opendbc/car/hyundai/hyundaican.py @@ -39,7 +39,7 @@ def create_lkas11(packer, frame, CP, apply_torque, steer_req, CAR.HYUNDAI_SANTA_FE_2022, CAR.KIA_K5_2021, CAR.HYUNDAI_IONIQ_HEV_2022, CAR.HYUNDAI_SANTA_FE_HEV_2022, CAR.HYUNDAI_SANTA_FE_PHEV_2022, CAR.KIA_STINGER_2022, CAR.KIA_K5_HEV_2020, CAR.KIA_CEED, CAR.HYUNDAI_AZERA_6TH_GEN, CAR.HYUNDAI_AZERA_HEV_6TH_GEN, CAR.HYUNDAI_CUSTIN_1ST_GEN, CAR.HYUNDAI_KONA_2022, - CAR.HYUNDAI_ELANTRA_2024): + CAR.HYUNDAI_ELANTRA_2024, CAR.HYUNDAI_ELANTRA_HEV_2024): values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) values["CF_Lkas_LdwsOpt_USM"] = 2 diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 1dafd6ee80d..a9a7e83c7f2 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -211,6 +211,11 @@ class CAR(Platforms): CarSpecs(mass=3017 * CV.LB_TO_KG, wheelbase=2.72, steerRatio=12.9, tireStiffnessFactor=0.65), flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.HYBRID, ) + HYUNDAI_ELANTRA_HEV_2024 = HyundaiPlatformConfig( + [HyundaiCarDocs("Hyundai Elantra Hybrid 2024-25", car_parts=CarParts.common([CarHarness.hyundai_k]))], + CarSpecs(mass=3017 * CV.LB_TO_KG, wheelbase=2.72, steerRatio=12.9, tireStiffnessFactor=0.65), + flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.CAMERA_SCC | HyundaiFlags.HYBRID, + ) HYUNDAI_GENESIS = HyundaiPlatformConfig( [ # TODO: check 2015 packages diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index 303caf01232..562448e013b 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -186,6 +186,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("82e9cdd3f43bf83e|2021-05-15--02-42-51", HYUNDAI.HYUNDAI_ELANTRA_2021), CarTestRoute("c2fd040a5e34f3ad/00000013--9211a52a3d", HYUNDAI.HYUNDAI_ELANTRA_2024), CarTestRoute("715ac05b594e9c59|2021-06-20--16-21-07", HYUNDAI.HYUNDAI_ELANTRA_HEV_2021), + CarTestRoute("65ef8b49f9b0dd24/00000006--886bf0e0d6", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), CarTestRoute("7120aa90bbc3add7|2021-08-02--07-12-31", HYUNDAI.HYUNDAI_SONATA_HYBRID), CarTestRoute("715ac05b594e9c59|2021-10-27--23-24-56", HYUNDAI.GENESIS_G70_2020), CarTestRoute("6b0d44d22df18134|2023-05-06--10-36-55", HYUNDAI.GENESIS_GV80), diff --git a/opendbc/car/torque_data/substitute.toml b/opendbc/car/torque_data/substitute.toml index 196da1414a2..9874ae8d33f 100644 --- a/opendbc/car/torque_data/substitute.toml +++ b/opendbc/car/torque_data/substitute.toml @@ -39,6 +39,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "HYUNDAI_ELANTRA_2024" = "HYUNDAI_ELANTRA_2021" "HYUNDAI_ELANTRA_GT_I30" = "HYUNDAI_SONATA_LF" "HYUNDAI_ELANTRA_HEV_2021" = "HYUNDAI_SONATA" +"HYUNDAI_ELANTRA_HEV_2024" = "HYUNDAI_SONATA" "HYUNDAI_TUCSON" = "HYUNDAI_SANTA_FE" "HYUNDAI_SANTA_FE_2022" = "HYUNDAI_SANTA_FE_HEV_2022" "KIA_K5_HEV_2020" = "KIA_K5_2021" From 4363c2e8d9ce1ab790085f1e74f141dd0205573f Mon Sep 17 00:00:00 2001 From: royjr Date: Fri, 14 Mar 2025 21:45:05 -0400 Subject: [PATCH 10/23] add I30 fps --- opendbc/car/hyundai/fingerprints.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index f142281ca1b..261135c8728 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -943,8 +943,10 @@ ], (Ecu.eps, 0x7d4, None): [ b'\xf1\x00CN7 MDPS C 1.00 1.00 56300BY670\x00 4CSHC100', + b'\xf1\x00CN7 MDPS C 1.00 1.00 56300BY680\x00 4CSHC100', ], (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00CN7HMFC AT AUS RHD 1.00 1.02 99210-AA500 230420', b'\xf1\x00CN7HMFC AT CAN LHD 1.00 1.05 99210-AA510 240509', b'\xf1\x00CN7HMFC AT USA LHD 1.00 1.03 99210-AA500 230918', ], From e48aa56c61509c728fbac20fa482be521dfa9af2 Mon Sep 17 00:00:00 2001 From: royjr Date: Fri, 14 Mar 2025 21:53:34 -0400 Subject: [PATCH 11/23] add I30 --- opendbc/car/hyundai/values.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index a9a7e83c7f2..e54d7d08c9a 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -212,7 +212,10 @@ class CAR(Platforms): flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.HYBRID, ) HYUNDAI_ELANTRA_HEV_2024 = HyundaiPlatformConfig( - [HyundaiCarDocs("Hyundai Elantra Hybrid 2024-25", car_parts=CarParts.common([CarHarness.hyundai_k]))], + [ + HyundaiCarDocs("Hyundai Elantra Hybrid 2024-25", car_parts=CarParts.common([CarHarness.hyundai_k])), + HyundaiCarDocs("Hyundai i30 Hybrid 2024", car_parts=CarParts.common([CarHarness.hyundai_k])), + ], CarSpecs(mass=3017 * CV.LB_TO_KG, wheelbase=2.72, steerRatio=12.9, tireStiffnessFactor=0.65), flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.CAMERA_SCC | HyundaiFlags.HYBRID, ) From e1ff53c8020c92967b4d3b33b299accdcb5399d2 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 22 Mar 2025 23:07:06 -0400 Subject: [PATCH 12/23] add Hyundai i30 Hybrid 2024 route --- opendbc/car/tests/routes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index 562448e013b..02e0fb1ae36 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -187,6 +187,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("c2fd040a5e34f3ad/00000013--9211a52a3d", HYUNDAI.HYUNDAI_ELANTRA_2024), CarTestRoute("715ac05b594e9c59|2021-06-20--16-21-07", HYUNDAI.HYUNDAI_ELANTRA_HEV_2021), CarTestRoute("65ef8b49f9b0dd24/00000006--886bf0e0d6", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), + CarTestRoute("07a48901db7b2503/0000000f--697d5906e8", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), # Hyundai i30 Hybrid 2024 CarTestRoute("7120aa90bbc3add7|2021-08-02--07-12-31", HYUNDAI.HYUNDAI_SONATA_HYBRID), CarTestRoute("715ac05b594e9c59|2021-10-27--23-24-56", HYUNDAI.GENESIS_G70_2020), CarTestRoute("6b0d44d22df18134|2023-05-06--10-36-55", HYUNDAI.GENESIS_GV80), From 2c52a5188d26a5344f9707e00f76898b6c510ecb Mon Sep 17 00:00:00 2001 From: royjr Date: Sun, 17 Aug 2025 23:28:47 -0400 Subject: [PATCH 13/23] maybe --- opendbc/car/hyundai/interface.py | 2 ++ opendbc/car/hyundai/values.py | 7 +++-- opendbc/safety/modes/hyundai.h | 49 +++++++++++++++++++++++++------- 3 files changed, 46 insertions(+), 12 deletions(-) diff --git a/opendbc/car/hyundai/interface.py b/opendbc/car/hyundai/interface.py index 1e058c4fce7..2da3d7ba35f 100644 --- a/opendbc/car/hyundai/interface.py +++ b/opendbc/car/hyundai/interface.py @@ -102,6 +102,8 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, alpha_lo if ret.flags & HyundaiFlags.CAMERA_SCC: ret.safetyConfigs[0].safetyParam |= HyundaiSafetyFlags.CAMERA_SCC.value + if ret.flags & HyundaiFlags.LFAHDA_MFC_ALT: + ret.safetyConfigs[0].safetyParam |= HyundaiSafetyFlags.LFAHDA_MFC_ALT.value # These cars have the LFA button on the steering wheel if 0x391 in fingerprint[0]: diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 552d50b7e36..3921910bee1 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -66,6 +66,7 @@ class HyundaiSafetyFlags(IntFlag): CANFD_LKA_STEERING_ALT = 128 FCEV_GAS = 256 ALT_LIMITS_2 = 512 + LFAHDA_MFC_ALT = 1024 class HyundaiFlags(IntFlag): @@ -126,6 +127,8 @@ class HyundaiFlags(IntFlag): ALT_LIMITS_2 = 2 ** 26 + LFAHDA_MFC_ALT = 2 ** 27 + class Footnote(Enum): CANFD = CarFootnote( @@ -203,7 +206,7 @@ class CAR(Platforms): HYUNDAI_ELANTRA_2024 = HyundaiPlatformConfig( [HyundaiCarDocs("Hyundai Elantra 2024-25", car_parts=CarParts.common([CarHarness.hyundai_k]))], CarSpecs(mass=2797 * CV.LB_TO_KG, wheelbase=2.72, steerRatio=12.9, tireStiffnessFactor=0.65), - flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.CAMERA_SCC, + flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.CAMERA_SCC | HyundaiFlags.LFAHDA_MFC_ALT, ) HYUNDAI_ELANTRA_HEV_2021 = HyundaiPlatformConfig( [HyundaiCarDocs("Hyundai Elantra Hybrid 2021-23", video="https://youtu.be/_EdYQtV52-c", @@ -217,7 +220,7 @@ class CAR(Platforms): HyundaiCarDocs("Hyundai i30 Hybrid 2024", car_parts=CarParts.common([CarHarness.hyundai_k])), ], CarSpecs(mass=3017 * CV.LB_TO_KG, wheelbase=2.72, steerRatio=12.9, tireStiffnessFactor=0.65), - flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.CAMERA_SCC | HyundaiFlags.HYBRID, + flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.CAMERA_SCC | HyundaiFlags.HYBRID | HyundaiFlags.LFAHDA_MFC_ALT, ) HYUNDAI_GENESIS = HyundaiPlatformConfig( [ diff --git a/opendbc/safety/modes/hyundai.h b/opendbc/safety/modes/hyundai.h index 8855a6b323c..179f235ae78 100644 --- a/opendbc/safety/modes/hyundai.h +++ b/opendbc/safety/modes/hyundai.h @@ -25,13 +25,16 @@ const LongitudinalLimits HYUNDAI_LONG_LIMITS = { .min_accel = -350, // 1/100 m/s2 }; -#define HYUNDAI_COMMON_TX_MSGS(scc_bus) \ +#define HYUNDAI_LFAHDA_MFC_TX_MSGS(lfahda_mfc_size) \ + {0x485, 0, lfahda_mfc_size, .check_relay = true}, /* LFAHDA_MFC Bus 0 */ \ + +#define HYUNDAI_COMMON_TX_MSGS(scc_bus, lfahda_mfc_size) \ + HYUNDAI_LFAHDA_MFC_TX_MSGS(lfahda_mfc_size) \ {0x340, 0, 8, .check_relay = true}, /* LKAS11 Bus 0 */ \ {0x4F1, scc_bus, 4, .check_relay = false}, /* CLU11 Bus 0 (radar-SCC) or 2 (camera-SCC) */ \ - {0x485, 0, 8, .check_relay = true}, /* LFAHDA_MFC Bus 0 */ \ -#define HYUNDAI_LONG_COMMON_TX_MSGS(scc_bus) \ - HYUNDAI_COMMON_TX_MSGS(scc_bus) \ +#define HYUNDAI_LONG_COMMON_TX_MSGS(scc_bus, lfahda_mfc_size) \ + HYUNDAI_COMMON_TX_MSGS(scc_bus, lfahda_mfc_size) \ {0x420, 0, 8, .check_relay = true}, /* SCC11 Bus 0 */ \ {0x421, 0, 8, .check_relay = true}, /* SCC12 Bus 0 */ \ {0x50A, 0, 8, .check_relay = true}, /* SCC13 Bus 0 */ \ @@ -53,10 +56,15 @@ const LongitudinalLimits HYUNDAI_LONG_LIMITS = { {.msg = {{0x91, 0, 8, 100U, .ignore_checksum = true, .ignore_counter = true, .ignore_quality_flag = true}, { 0 }, { 0 }}}, \ static const CanMsg HYUNDAI_TX_MSGS[] = { - HYUNDAI_COMMON_TX_MSGS(0) + HYUNDAI_COMMON_TX_MSGS(0, 4) }; static bool hyundai_legacy = false; +static bool hyundai_lfahda_mfc_alt = false; + +static bool get_hyundai_lfahda_mfc_alt(void) { + return hyundai_lfahda_mfc_alt; +} static uint8_t hyundai_get_counter(const CANPacket_t *msg) { @@ -249,19 +257,30 @@ static bool hyundai_tx_hook(const CANPacket_t *msg) { } static safety_config hyundai_init(uint16_t param) { + const int HYUNDAI_LFAHDA_MFC_ALT = 1024; + hyundai_lfahda_mfc_alt = GET_FLAG(param, HYUNDAI_LFAHDA_MFC_ALT); + static const CanMsg HYUNDAI_LONG_TX_MSGS[] = { - HYUNDAI_LONG_COMMON_TX_MSGS(0) + HYUNDAI_LONG_COMMON_TX_MSGS(0, 4) {0x38D, 0, 8, .check_relay = false}, // FCA11 Bus 0 {0x483, 0, 8, .check_relay = false}, // FCA12 Bus 0 {0x7D0, 0, 8, .check_relay = false}, // radar UDS TX addr Bus 0 (for radar disable) }; static const CanMsg HYUNDAI_CAMERA_SCC_TX_MSGS[] = { - HYUNDAI_COMMON_TX_MSGS(2) + HYUNDAI_COMMON_TX_MSGS(2, 4) + }; + + static const CanMsg HYUNDAI_COMMON_LFAHDA_MFC_ALT_TX_MSGS[] = { + HYUNDAI_COMMON_TX_MSGS(2, 8) }; static const CanMsg HYUNDAI_CAMERA_SCC_LONG_TX_MSGS[] = { - HYUNDAI_LONG_COMMON_TX_MSGS(2) + HYUNDAI_LONG_COMMON_TX_MSGS(2, 4) + }; + + static const CanMsg HYUNDAI_LONG_COMMON_LFAHDA_MFC_ALT_TX_MSGS[] = { + HYUNDAI_LONG_COMMON_TX_MSGS(2, 8) }; hyundai_common_init(param); @@ -285,7 +304,11 @@ static safety_config hyundai_init(uint16_t param) { SET_RX_CHECKS(hyundai_long_rx_checks, ret); } if (hyundai_camera_scc) { - SET_TX_MSGS(HYUNDAI_CAMERA_SCC_LONG_TX_MSGS, ret); + if (get_hyundai_lfahda_mfc_alt()) { + SET_TX_MSGS(HYUNDAI_LONG_COMMON_LFAHDA_MFC_ALT_TX_MSGS, ret); + } else { + SET_TX_MSGS(HYUNDAI_CAMERA_SCC_LONG_TX_MSGS, ret); + } } else { SET_TX_MSGS(HYUNDAI_LONG_TX_MSGS, ret); } @@ -296,7 +319,12 @@ static safety_config hyundai_init(uint16_t param) { HYUNDAI_SCC12_ADDR_CHECK(2) }; - ret = BUILD_SAFETY_CFG(hyundai_cam_scc_rx_checks, HYUNDAI_CAMERA_SCC_TX_MSGS); + + if (get_hyundai_lfahda_mfc_alt()) { + ret = BUILD_SAFETY_CFG(hyundai_cam_scc_rx_checks, HYUNDAI_COMMON_LFAHDA_MFC_ALT_TX_MSGS); + } else { + ret = BUILD_SAFETY_CFG(hyundai_cam_scc_rx_checks, HYUNDAI_CAMERA_SCC_TX_MSGS); + } } else { static RxCheck hyundai_rx_checks[] = { HYUNDAI_COMMON_RX_CHECKS(false) @@ -330,6 +358,7 @@ static safety_config hyundai_legacy_init(uint16_t param) { hyundai_legacy = true; hyundai_longitudinal = false; hyundai_camera_scc = false; + hyundai_lfahda_mfc_alt = false; return BUILD_SAFETY_CFG(hyundai_legacy_rx_checks, HYUNDAI_TX_MSGS); } From a63f25fb23c8f06f4ab750fefcf3f2c3e2ff7b00 Mon Sep 17 00:00:00 2001 From: royjr Date: Sun, 17 Aug 2025 23:32:23 -0400 Subject: [PATCH 14/23] for now --- opendbc/safety/modes/hyundai.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opendbc/safety/modes/hyundai.h b/opendbc/safety/modes/hyundai.h index 179f235ae78..af033604088 100644 --- a/opendbc/safety/modes/hyundai.h +++ b/opendbc/safety/modes/hyundai.h @@ -305,7 +305,7 @@ static safety_config hyundai_init(uint16_t param) { } if (hyundai_camera_scc) { if (get_hyundai_lfahda_mfc_alt()) { - SET_TX_MSGS(HYUNDAI_LONG_COMMON_LFAHDA_MFC_ALT_TX_MSGS, ret); + SET_TX_MSGS(HYUNDAI_LONG_COMMON_LFAHDA_MFC_ALT_TX_MSGS, ret); // LCOV_EXCL_LINE } else { SET_TX_MSGS(HYUNDAI_CAMERA_SCC_LONG_TX_MSGS, ret); } @@ -321,7 +321,7 @@ static safety_config hyundai_init(uint16_t param) { if (get_hyundai_lfahda_mfc_alt()) { - ret = BUILD_SAFETY_CFG(hyundai_cam_scc_rx_checks, HYUNDAI_COMMON_LFAHDA_MFC_ALT_TX_MSGS); + ret = BUILD_SAFETY_CFG(hyundai_cam_scc_rx_checks, HYUNDAI_COMMON_LFAHDA_MFC_ALT_TX_MSGS); // LCOV_EXCL_LINE } else { ret = BUILD_SAFETY_CFG(hyundai_cam_scc_rx_checks, HYUNDAI_CAMERA_SCC_TX_MSGS); } From 2aa97eae89747c498de909a0f9459a6d728e1fef Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 18 Aug 2025 14:38:23 -0400 Subject: [PATCH 15/23] Update routes.py --- opendbc/car/tests/routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index 134e5a55e50..c6b79b6488a 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -192,7 +192,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("82e9cdd3f43bf83e/2021-05-15--02-42-51", HYUNDAI.HYUNDAI_ELANTRA_2021), CarTestRoute("c2fd040a5e34f3ad/00000013--9211a52a3d", HYUNDAI.HYUNDAI_ELANTRA_2024), CarTestRoute("715ac05b594e9c59/2021-06-20--16-21-07", HYUNDAI.HYUNDAI_ELANTRA_HEV_2021), - CarTestRoute("65ef8b49f9b0dd24/00000006--886bf0e0d6", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), + CarTestRoute("65ef8b49f9b0dd24/00000141--5c8720a01c", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), CarTestRoute("07a48901db7b2503/0000000f--697d5906e8", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), # Hyundai i30 Hybrid 2024 CarTestRoute("7120aa90bbc3add7/2021-08-02--07-12-31", HYUNDAI.HYUNDAI_SONATA_HYBRID), CarTestRoute("715ac05b594e9c59/2021-10-27--23-24-56", HYUNDAI.GENESIS_G70_2020), From 1aae478ee433f52f98ad7cffa82bd9555c98b30c Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 18 Aug 2025 14:40:08 -0400 Subject: [PATCH 16/23] Update routes.py --- opendbc/car/tests/routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index c6b79b6488a..35dcf18bb90 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -193,7 +193,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("c2fd040a5e34f3ad/00000013--9211a52a3d", HYUNDAI.HYUNDAI_ELANTRA_2024), CarTestRoute("715ac05b594e9c59/2021-06-20--16-21-07", HYUNDAI.HYUNDAI_ELANTRA_HEV_2021), CarTestRoute("65ef8b49f9b0dd24/00000141--5c8720a01c", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), - CarTestRoute("07a48901db7b2503/0000000f--697d5906e8", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), # Hyundai i30 Hybrid 2024 + # CarTestRoute("07a48901db7b2503/0000000f--697d5906e8", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), # Hyundai i30 Hybrid 2024 CarTestRoute("7120aa90bbc3add7/2021-08-02--07-12-31", HYUNDAI.HYUNDAI_SONATA_HYBRID), CarTestRoute("715ac05b594e9c59/2021-10-27--23-24-56", HYUNDAI.GENESIS_G70_2020), CarTestRoute("6b0d44d22df18134/2023-05-06--10-36-55", HYUNDAI.GENESIS_GV80), From 49896bedc5019be50c8fdba7a4a4d875b3ab6407 Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 8 Sep 2025 00:30:22 -0400 Subject: [PATCH 17/23] Revert "for now" This reverts commit a63f25fb23c8f06f4ab750fefcf3f2c3e2ff7b00. --- opendbc/safety/modes/hyundai.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opendbc/safety/modes/hyundai.h b/opendbc/safety/modes/hyundai.h index af033604088..179f235ae78 100644 --- a/opendbc/safety/modes/hyundai.h +++ b/opendbc/safety/modes/hyundai.h @@ -305,7 +305,7 @@ static safety_config hyundai_init(uint16_t param) { } if (hyundai_camera_scc) { if (get_hyundai_lfahda_mfc_alt()) { - SET_TX_MSGS(HYUNDAI_LONG_COMMON_LFAHDA_MFC_ALT_TX_MSGS, ret); // LCOV_EXCL_LINE + SET_TX_MSGS(HYUNDAI_LONG_COMMON_LFAHDA_MFC_ALT_TX_MSGS, ret); } else { SET_TX_MSGS(HYUNDAI_CAMERA_SCC_LONG_TX_MSGS, ret); } @@ -321,7 +321,7 @@ static safety_config hyundai_init(uint16_t param) { if (get_hyundai_lfahda_mfc_alt()) { - ret = BUILD_SAFETY_CFG(hyundai_cam_scc_rx_checks, HYUNDAI_COMMON_LFAHDA_MFC_ALT_TX_MSGS); // LCOV_EXCL_LINE + ret = BUILD_SAFETY_CFG(hyundai_cam_scc_rx_checks, HYUNDAI_COMMON_LFAHDA_MFC_ALT_TX_MSGS); } else { ret = BUILD_SAFETY_CFG(hyundai_cam_scc_rx_checks, HYUNDAI_CAMERA_SCC_TX_MSGS); } From a93d1261fd65fc761c73d7130abbb5083a916146 Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 8 Sep 2025 00:30:31 -0400 Subject: [PATCH 18/23] Revert "maybe" This reverts commit 2c52a5188d26a5344f9707e00f76898b6c510ecb. --- opendbc/car/hyundai/interface.py | 2 -- opendbc/car/hyundai/values.py | 7 ++--- opendbc/safety/modes/hyundai.h | 49 +++++++------------------------- 3 files changed, 12 insertions(+), 46 deletions(-) diff --git a/opendbc/car/hyundai/interface.py b/opendbc/car/hyundai/interface.py index 2da3d7ba35f..1e058c4fce7 100644 --- a/opendbc/car/hyundai/interface.py +++ b/opendbc/car/hyundai/interface.py @@ -102,8 +102,6 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, alpha_lo if ret.flags & HyundaiFlags.CAMERA_SCC: ret.safetyConfigs[0].safetyParam |= HyundaiSafetyFlags.CAMERA_SCC.value - if ret.flags & HyundaiFlags.LFAHDA_MFC_ALT: - ret.safetyConfigs[0].safetyParam |= HyundaiSafetyFlags.LFAHDA_MFC_ALT.value # These cars have the LFA button on the steering wheel if 0x391 in fingerprint[0]: diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 3921910bee1..552d50b7e36 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -66,7 +66,6 @@ class HyundaiSafetyFlags(IntFlag): CANFD_LKA_STEERING_ALT = 128 FCEV_GAS = 256 ALT_LIMITS_2 = 512 - LFAHDA_MFC_ALT = 1024 class HyundaiFlags(IntFlag): @@ -127,8 +126,6 @@ class HyundaiFlags(IntFlag): ALT_LIMITS_2 = 2 ** 26 - LFAHDA_MFC_ALT = 2 ** 27 - class Footnote(Enum): CANFD = CarFootnote( @@ -206,7 +203,7 @@ class CAR(Platforms): HYUNDAI_ELANTRA_2024 = HyundaiPlatformConfig( [HyundaiCarDocs("Hyundai Elantra 2024-25", car_parts=CarParts.common([CarHarness.hyundai_k]))], CarSpecs(mass=2797 * CV.LB_TO_KG, wheelbase=2.72, steerRatio=12.9, tireStiffnessFactor=0.65), - flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.CAMERA_SCC | HyundaiFlags.LFAHDA_MFC_ALT, + flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.CAMERA_SCC, ) HYUNDAI_ELANTRA_HEV_2021 = HyundaiPlatformConfig( [HyundaiCarDocs("Hyundai Elantra Hybrid 2021-23", video="https://youtu.be/_EdYQtV52-c", @@ -220,7 +217,7 @@ class CAR(Platforms): HyundaiCarDocs("Hyundai i30 Hybrid 2024", car_parts=CarParts.common([CarHarness.hyundai_k])), ], CarSpecs(mass=3017 * CV.LB_TO_KG, wheelbase=2.72, steerRatio=12.9, tireStiffnessFactor=0.65), - flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.CAMERA_SCC | HyundaiFlags.HYBRID | HyundaiFlags.LFAHDA_MFC_ALT, + flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.CAMERA_SCC | HyundaiFlags.HYBRID, ) HYUNDAI_GENESIS = HyundaiPlatformConfig( [ diff --git a/opendbc/safety/modes/hyundai.h b/opendbc/safety/modes/hyundai.h index 179f235ae78..8855a6b323c 100644 --- a/opendbc/safety/modes/hyundai.h +++ b/opendbc/safety/modes/hyundai.h @@ -25,16 +25,13 @@ const LongitudinalLimits HYUNDAI_LONG_LIMITS = { .min_accel = -350, // 1/100 m/s2 }; -#define HYUNDAI_LFAHDA_MFC_TX_MSGS(lfahda_mfc_size) \ - {0x485, 0, lfahda_mfc_size, .check_relay = true}, /* LFAHDA_MFC Bus 0 */ \ - -#define HYUNDAI_COMMON_TX_MSGS(scc_bus, lfahda_mfc_size) \ - HYUNDAI_LFAHDA_MFC_TX_MSGS(lfahda_mfc_size) \ +#define HYUNDAI_COMMON_TX_MSGS(scc_bus) \ {0x340, 0, 8, .check_relay = true}, /* LKAS11 Bus 0 */ \ {0x4F1, scc_bus, 4, .check_relay = false}, /* CLU11 Bus 0 (radar-SCC) or 2 (camera-SCC) */ \ + {0x485, 0, 8, .check_relay = true}, /* LFAHDA_MFC Bus 0 */ \ -#define HYUNDAI_LONG_COMMON_TX_MSGS(scc_bus, lfahda_mfc_size) \ - HYUNDAI_COMMON_TX_MSGS(scc_bus, lfahda_mfc_size) \ +#define HYUNDAI_LONG_COMMON_TX_MSGS(scc_bus) \ + HYUNDAI_COMMON_TX_MSGS(scc_bus) \ {0x420, 0, 8, .check_relay = true}, /* SCC11 Bus 0 */ \ {0x421, 0, 8, .check_relay = true}, /* SCC12 Bus 0 */ \ {0x50A, 0, 8, .check_relay = true}, /* SCC13 Bus 0 */ \ @@ -56,15 +53,10 @@ const LongitudinalLimits HYUNDAI_LONG_LIMITS = { {.msg = {{0x91, 0, 8, 100U, .ignore_checksum = true, .ignore_counter = true, .ignore_quality_flag = true}, { 0 }, { 0 }}}, \ static const CanMsg HYUNDAI_TX_MSGS[] = { - HYUNDAI_COMMON_TX_MSGS(0, 4) + HYUNDAI_COMMON_TX_MSGS(0) }; static bool hyundai_legacy = false; -static bool hyundai_lfahda_mfc_alt = false; - -static bool get_hyundai_lfahda_mfc_alt(void) { - return hyundai_lfahda_mfc_alt; -} static uint8_t hyundai_get_counter(const CANPacket_t *msg) { @@ -257,30 +249,19 @@ static bool hyundai_tx_hook(const CANPacket_t *msg) { } static safety_config hyundai_init(uint16_t param) { - const int HYUNDAI_LFAHDA_MFC_ALT = 1024; - hyundai_lfahda_mfc_alt = GET_FLAG(param, HYUNDAI_LFAHDA_MFC_ALT); - static const CanMsg HYUNDAI_LONG_TX_MSGS[] = { - HYUNDAI_LONG_COMMON_TX_MSGS(0, 4) + HYUNDAI_LONG_COMMON_TX_MSGS(0) {0x38D, 0, 8, .check_relay = false}, // FCA11 Bus 0 {0x483, 0, 8, .check_relay = false}, // FCA12 Bus 0 {0x7D0, 0, 8, .check_relay = false}, // radar UDS TX addr Bus 0 (for radar disable) }; static const CanMsg HYUNDAI_CAMERA_SCC_TX_MSGS[] = { - HYUNDAI_COMMON_TX_MSGS(2, 4) - }; - - static const CanMsg HYUNDAI_COMMON_LFAHDA_MFC_ALT_TX_MSGS[] = { - HYUNDAI_COMMON_TX_MSGS(2, 8) + HYUNDAI_COMMON_TX_MSGS(2) }; static const CanMsg HYUNDAI_CAMERA_SCC_LONG_TX_MSGS[] = { - HYUNDAI_LONG_COMMON_TX_MSGS(2, 4) - }; - - static const CanMsg HYUNDAI_LONG_COMMON_LFAHDA_MFC_ALT_TX_MSGS[] = { - HYUNDAI_LONG_COMMON_TX_MSGS(2, 8) + HYUNDAI_LONG_COMMON_TX_MSGS(2) }; hyundai_common_init(param); @@ -304,11 +285,7 @@ static safety_config hyundai_init(uint16_t param) { SET_RX_CHECKS(hyundai_long_rx_checks, ret); } if (hyundai_camera_scc) { - if (get_hyundai_lfahda_mfc_alt()) { - SET_TX_MSGS(HYUNDAI_LONG_COMMON_LFAHDA_MFC_ALT_TX_MSGS, ret); - } else { - SET_TX_MSGS(HYUNDAI_CAMERA_SCC_LONG_TX_MSGS, ret); - } + SET_TX_MSGS(HYUNDAI_CAMERA_SCC_LONG_TX_MSGS, ret); } else { SET_TX_MSGS(HYUNDAI_LONG_TX_MSGS, ret); } @@ -319,12 +296,7 @@ static safety_config hyundai_init(uint16_t param) { HYUNDAI_SCC12_ADDR_CHECK(2) }; - - if (get_hyundai_lfahda_mfc_alt()) { - ret = BUILD_SAFETY_CFG(hyundai_cam_scc_rx_checks, HYUNDAI_COMMON_LFAHDA_MFC_ALT_TX_MSGS); - } else { - ret = BUILD_SAFETY_CFG(hyundai_cam_scc_rx_checks, HYUNDAI_CAMERA_SCC_TX_MSGS); - } + ret = BUILD_SAFETY_CFG(hyundai_cam_scc_rx_checks, HYUNDAI_CAMERA_SCC_TX_MSGS); } else { static RxCheck hyundai_rx_checks[] = { HYUNDAI_COMMON_RX_CHECKS(false) @@ -358,7 +330,6 @@ static safety_config hyundai_legacy_init(uint16_t param) { hyundai_legacy = true; hyundai_longitudinal = false; hyundai_camera_scc = false; - hyundai_lfahda_mfc_alt = false; return BUILD_SAFETY_CFG(hyundai_legacy_rx_checks, HYUNDAI_TX_MSGS); } From 609ff293e0f9ccd4010d8c0ffdaeb7a84412d12c Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 8 Sep 2025 00:45:20 -0400 Subject: [PATCH 19/23] try this? --- opendbc/car/tests/routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index 63718227eee..f565f3fa038 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -193,7 +193,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("82e9cdd3f43bf83e/2021-05-15--02-42-51", HYUNDAI.HYUNDAI_ELANTRA_2021), CarTestRoute("c2fd040a5e34f3ad/00000013--9211a52a3d", HYUNDAI.HYUNDAI_ELANTRA_2024), CarTestRoute("715ac05b594e9c59/2021-06-20--16-21-07", HYUNDAI.HYUNDAI_ELANTRA_HEV_2021), - CarTestRoute("65ef8b49f9b0dd24/00000141--5c8720a01c", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), + CarTestRoute("07a48901db7b2503/000001a1--ad07872c4f", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), # CarTestRoute("07a48901db7b2503/0000000f--697d5906e8", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), # Hyundai i30 Hybrid 2024 CarTestRoute("7120aa90bbc3add7/2021-08-02--07-12-31", HYUNDAI.HYUNDAI_SONATA_HYBRID), CarTestRoute("715ac05b594e9c59/2021-10-27--23-24-56", HYUNDAI.GENESIS_G70_2020), From eb4db9db3e99dca212cc93214b8c3e93c33d547d Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 8 Sep 2025 00:56:16 -0400 Subject: [PATCH 20/23] this is Hyundai i30 Hybrid 2024 --- opendbc/car/tests/routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index f565f3fa038..7801a799d7d 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -194,7 +194,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("c2fd040a5e34f3ad/00000013--9211a52a3d", HYUNDAI.HYUNDAI_ELANTRA_2024), CarTestRoute("715ac05b594e9c59/2021-06-20--16-21-07", HYUNDAI.HYUNDAI_ELANTRA_HEV_2021), CarTestRoute("07a48901db7b2503/000001a1--ad07872c4f", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), - # CarTestRoute("07a48901db7b2503/0000000f--697d5906e8", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), # Hyundai i30 Hybrid 2024 + CarTestRoute("07a48901db7b2503/000001a1--ad07872c4f", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), # Hyundai i30 Hybrid 2024 CarTestRoute("7120aa90bbc3add7/2021-08-02--07-12-31", HYUNDAI.HYUNDAI_SONATA_HYBRID), CarTestRoute("715ac05b594e9c59/2021-10-27--23-24-56", HYUNDAI.GENESIS_G70_2020), CarTestRoute("6b0d44d22df18134/2023-05-06--10-36-55", HYUNDAI.GENESIS_GV80), From 0416b8afa67eb5b4071850e94424a95a66e336a1 Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 8 Sep 2025 22:51:54 -0400 Subject: [PATCH 21/23] this is really HYUNDAI_ELANTRA_HEV_2024 --- opendbc/car/tests/routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index 7801a799d7d..2e3ab279e42 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -193,7 +193,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("82e9cdd3f43bf83e/2021-05-15--02-42-51", HYUNDAI.HYUNDAI_ELANTRA_2021), CarTestRoute("c2fd040a5e34f3ad/00000013--9211a52a3d", HYUNDAI.HYUNDAI_ELANTRA_2024), CarTestRoute("715ac05b594e9c59/2021-06-20--16-21-07", HYUNDAI.HYUNDAI_ELANTRA_HEV_2021), - CarTestRoute("07a48901db7b2503/000001a1--ad07872c4f", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), + CarTestRoute("ee69d19672bd8ddb/00000009--c5953a5a54", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), CarTestRoute("07a48901db7b2503/000001a1--ad07872c4f", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), # Hyundai i30 Hybrid 2024 CarTestRoute("7120aa90bbc3add7/2021-08-02--07-12-31", HYUNDAI.HYUNDAI_SONATA_HYBRID), CarTestRoute("715ac05b594e9c59/2021-10-27--23-24-56", HYUNDAI.GENESIS_G70_2020), From 342426b362dbb3bc255f14441bda766468150f90 Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 8 Sep 2025 23:11:11 -0400 Subject: [PATCH 22/23] Revert "this is really HYUNDAI_ELANTRA_HEV_2024" This reverts commit 0416b8afa67eb5b4071850e94424a95a66e336a1. --- opendbc/car/tests/routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index 2e3ab279e42..7801a799d7d 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -193,7 +193,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("82e9cdd3f43bf83e/2021-05-15--02-42-51", HYUNDAI.HYUNDAI_ELANTRA_2021), CarTestRoute("c2fd040a5e34f3ad/00000013--9211a52a3d", HYUNDAI.HYUNDAI_ELANTRA_2024), CarTestRoute("715ac05b594e9c59/2021-06-20--16-21-07", HYUNDAI.HYUNDAI_ELANTRA_HEV_2021), - CarTestRoute("ee69d19672bd8ddb/00000009--c5953a5a54", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), + CarTestRoute("07a48901db7b2503/000001a1--ad07872c4f", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), CarTestRoute("07a48901db7b2503/000001a1--ad07872c4f", HYUNDAI.HYUNDAI_ELANTRA_HEV_2024), # Hyundai i30 Hybrid 2024 CarTestRoute("7120aa90bbc3add7/2021-08-02--07-12-31", HYUNDAI.HYUNDAI_SONATA_HYBRID), CarTestRoute("715ac05b594e9c59/2021-10-27--23-24-56", HYUNDAI.GENESIS_G70_2020), From 75d65feeba0446792a9bdb229ba86e6ed9c94680 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 24 Jan 2026 13:14:21 -0500 Subject: [PATCH 23/23] Update fingerprints.py --- opendbc/car/hyundai/fingerprints.py | 1 + 1 file changed, 1 insertion(+) diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index 594a9ecb317..b58c9084f3d 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -939,6 +939,7 @@ ], (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00CN7 MFC AT USA LHD 1.00 1.02 99210-AA500 230420', + b'\xf1\x00CN7 MFC AT USA LHD 1.00 1.03 99210-AA500 230918', ], (Ecu.abs, 0x7d1, None): [ b'\xf1\x00CN ESC \t 104#\x07\x03 58910-AA850',