Skip to content

Commit

Permalink
Hyundai CAN: Refactor forward hooks for blocked messages (#2046)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyhaibin authored Dec 11, 2024
1 parent dfa033d commit c60941c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions board/safety/safety_hyundai.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c60941c

Please sign in to comment.