From c4d883ce49e1001261a6acc88b4af499ae0e1b1e Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 28 Nov 2024 18:15:00 -0500 Subject: [PATCH 1/5] ccnc faults --- board/safety/safety_hyundai_canfd.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/board/safety/safety_hyundai_canfd.h b/board/safety/safety_hyundai_canfd.h index b42889bb0e..258a8c6e39 100644 --- a/board/safety/safety_hyundai_canfd.h +++ b/board/safety/safety_hyundai_canfd.h @@ -215,7 +215,9 @@ static int hyundai_canfd_fwd_hook(int bus_num, int addr) { // CRUISE_INFO for non-HDA2, we send our own longitudinal commands bool is_scc_msg = ((addr == 0x1a0) && hyundai_longitudinal && !hyundai_canfd_hda2); - bool block_msg = is_lkas_msg || is_lfa_msg || is_lfahda_msg || is_scc_msg; + bool is_block_fault = (addr == 0x162); + + bool block_msg = is_lkas_msg || is_lfa_msg || is_lfahda_msg || is_scc_msg || is_block_fault; if (!block_msg) { bus_fwd = 0; } @@ -261,6 +263,7 @@ static safety_config hyundai_canfd_init(uint16_t param) { {0x1A0, 0, 32}, // CRUISE_INFO {0x1CF, 2, 8}, // CRUISE_BUTTON {0x1E0, 0, 16}, // LFAHDA_CLUSTER + {0x162, 0, 32}, // BLOCK_FAULTS }; From 5e5d08e722676538eb71449cdf67c3cb9cbbe258 Mon Sep 17 00:00:00 2001 From: royjr Date: Fri, 6 Dec 2024 11:53:43 -0500 Subject: [PATCH 2/5] better --- board/safety/safety_hyundai_canfd.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/board/safety/safety_hyundai_canfd.h b/board/safety/safety_hyundai_canfd.h index 258a8c6e39..2611125004 100644 --- a/board/safety/safety_hyundai_canfd.h +++ b/board/safety/safety_hyundai_canfd.h @@ -215,9 +215,9 @@ static int hyundai_canfd_fwd_hook(int bus_num, int addr) { // CRUISE_INFO for non-HDA2, we send our own longitudinal commands bool is_scc_msg = ((addr == 0x1a0) && hyundai_longitudinal && !hyundai_canfd_hda2); - bool is_block_fault = (addr == 0x162); + bool is_ccnc_msg = (addr == 0x161) || (addr == 0x162); - bool block_msg = is_lkas_msg || is_lfa_msg || is_lfahda_msg || is_scc_msg || is_block_fault; + bool block_msg = is_lkas_msg || is_lfa_msg || is_lfahda_msg || is_scc_msg || is_ccnc_msg; if (!block_msg) { bus_fwd = 0; } @@ -263,7 +263,8 @@ static safety_config hyundai_canfd_init(uint16_t param) { {0x1A0, 0, 32}, // CRUISE_INFO {0x1CF, 2, 8}, // CRUISE_BUTTON {0x1E0, 0, 16}, // LFAHDA_CLUSTER - {0x162, 0, 32}, // BLOCK_FAULTS + {0x161, 0, 32}, // MSG_161 + {0x162, 0, 32}, // MSG_162 }; From 5350332ef40d5c7245ea870d1edfd19e9bef7036 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 7 Dec 2024 15:50:22 -0500 Subject: [PATCH 3/5] Update test_hyundai_canfd.py --- tests/safety/test_hyundai_canfd.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/safety/test_hyundai_canfd.py b/tests/safety/test_hyundai_canfd.py index 7f280b6319..ffa3c9e1a2 100755 --- a/tests/safety/test_hyundai_canfd.py +++ b/tests/safety/test_hyundai_canfd.py @@ -83,7 +83,7 @@ class TestHyundaiCanfdHDA1Base(TestHyundaiCanfdBase): TX_MSGS = [[0x12A, 0], [0x1A0, 1], [0x1CF, 0], [0x1E0, 0]] RELAY_MALFUNCTION_ADDRS = {0: (0x12A,)} # LFA - FWD_BLACKLISTED_ADDRS = {2: [0x12A, 0x1E0]} + FWD_BLACKLISTED_ADDRS = {2: [0x12A, 0x1E0, 0x161, 0x162]} FWD_BUS_LOOKUP = {0: 2, 2: 0} STEER_MSG = "LFA" @@ -160,7 +160,7 @@ class TestHyundaiCanfdHDA2EV(TestHyundaiCanfdBase): TX_MSGS = [[0x50, 0], [0x1CF, 1], [0x2A4, 0]] RELAY_MALFUNCTION_ADDRS = {0: (0x50,)} # LKAS - FWD_BLACKLISTED_ADDRS = {2: [0x50, 0x2a4]} + FWD_BLACKLISTED_ADDRS = {2: [0x50, 0x2a4, 0x161, 0x162]} FWD_BUS_LOOKUP = {0: 2, 2: 0} PT_BUS = 1 @@ -180,7 +180,7 @@ class TestHyundaiCanfdHDA2EVAltSteering(TestHyundaiCanfdBase): TX_MSGS = [[0x110, 0], [0x1CF, 1], [0x362, 0]] RELAY_MALFUNCTION_ADDRS = {0: (0x110,)} # LKAS_ALT - FWD_BLACKLISTED_ADDRS = {2: [0x110, 0x362]} + FWD_BLACKLISTED_ADDRS = {2: [0x110, 0x362, 0x161, 0x162]} FWD_BUS_LOOKUP = {0: 2, 2: 0} PT_BUS = 1 @@ -233,7 +233,7 @@ def _accel_msg(self, accel, aeb_req=False, aeb_decel=0): ]) class TestHyundaiCanfdHDA1Long(HyundaiLongitudinalBase, TestHyundaiCanfdHDA1Base): - FWD_BLACKLISTED_ADDRS = {2: [0x12a, 0x1e0, 0x1a0]} + FWD_BLACKLISTED_ADDRS = {2: [0x12a, 0x1e0, 0x1a0, 0x161, 0x162]} RELAY_MALFUNCTION_ADDRS = {0: (0x12A, 0x1a0)} # LFA, SCC_CONTROL From d4d439a16ecb878d9049a856ccde8b69a222b32d Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 26 Dec 2024 12:53:20 -0500 Subject: [PATCH 4/5] increase STEER_MAX --- board/safety/safety_hyundai_canfd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/safety/safety_hyundai_canfd.h b/board/safety/safety_hyundai_canfd.h index 2611125004..294a4a994d 100644 --- a/board/safety/safety_hyundai_canfd.h +++ b/board/safety/safety_hyundai_canfd.h @@ -122,7 +122,7 @@ static void hyundai_canfd_rx_hook(const CANPacket_t *to_push) { static bool hyundai_canfd_tx_hook(const CANPacket_t *to_send) { const SteeringLimits HYUNDAI_CANFD_STEERING_LIMITS = { - .max_steer = 270, + .max_steer = 384, .max_rt_delta = 112, .max_rt_interval = 250000, .max_rate_up = 2, From 713abf5a66e209507cd7ebda4b67f678a17bc242 Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 26 Dec 2024 14:43:24 -0500 Subject: [PATCH 5/5] Update test_hyundai_canfd.py --- tests/safety/test_hyundai_canfd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/safety/test_hyundai_canfd.py b/tests/safety/test_hyundai_canfd.py index ffa3c9e1a2..586ed78f74 100755 --- a/tests/safety/test_hyundai_canfd.py +++ b/tests/safety/test_hyundai_canfd.py @@ -17,7 +17,7 @@ class TestHyundaiCanfdBase(HyundaiButtonBase, common.PandaCarSafetyTest, common. MAX_RATE_UP = 2 MAX_RATE_DOWN = 3 - MAX_TORQUE = 270 + MAX_TORQUE = 384 MAX_RT_DELTA = 112 RT_INTERVAL = 250000