From c60941ca9801cf889b5b0a5622d465119992a885 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 11 Dec 2024 18:11:03 -0500 Subject: [PATCH] Hyundai CAN: Refactor forward hooks for blocked messages (#2046) --- board/safety/safety_hyundai.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/board/safety/safety_hyundai.h b/board/safety/safety_hyundai.h index 3e9d23216c..cf73afee62 100644 --- a/board/safety/safety_hyundai.h +++ b/board/safety/safety_hyundai.h @@ -250,8 +250,17 @@ static int hyundai_fwd_hook(int bus_num, int addr) { if (bus_num == 0) { bus_fwd = 2; } - if ((bus_num == 2) && (addr != 0x340) && (addr != 0x485)) { - bus_fwd = 0; + + if (bus_num == 2) { + // Stock LKAS11 messages + bool is_lkas_11 = (addr == 0x340); + // LFA and HDA cluster icons + bool is_lfahda_mfc = (addr == 0x485); + + bool block_msg = is_lkas_11 || is_lfahda_mfc; + if (!block_msg) { + bus_fwd = 0; + } } return bus_fwd;