Skip to content

Commit 4d82389

Browse files
committed
Nissan is also nice diff
1 parent 649cdd6 commit 4d82389

File tree

1 file changed

+6
-29
lines changed

1 file changed

+6
-29
lines changed

opendbc/safety/safety/safety_nissan.h

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -101,36 +101,14 @@ static bool nissan_tx_hook(const CANPacket_t *to_send) {
101101
return tx;
102102
}
103103

104-
105-
static int nissan_fwd_hook(int bus_num, int addr) {
106-
int bus_fwd = -1;
107-
108-
if (bus_num == 0) {
109-
bool block_msg = (addr == 0x280); // CANCEL_MSG
110-
if (!block_msg) {
111-
bus_fwd = 2; // ADAS
112-
}
113-
}
114-
115-
if (bus_num == 2) {
116-
// 0x169 is LKAS, 0x2b1 LKAS_HUD, 0x4cc LKAS_HUD_INFO_MSG
117-
bool block_msg = ((addr == 0x169) || (addr == 0x2b1) || (addr == 0x4cc));
118-
if (!block_msg) {
119-
bus_fwd = 0; // V-CAN
120-
}
121-
}
122-
123-
return bus_fwd;
124-
}
125-
126104
static safety_config nissan_init(uint16_t param) {
127105
static const CanMsg NISSAN_TX_MSGS[] = {
128-
{0x169, 0, 8}, // LKAS
129-
{0x2b1, 0, 8}, // PROPILOT_HUD
130-
{0x4cc, 0, 8}, // PROPILOT_HUD_INFO_MSG
131-
{0x20b, 2, 6}, // CRUISE_THROTTLE (X-Trail)
132-
{0x20b, 1, 6}, // CRUISE_THROTTLE (Altima)
133-
{0x280, 2, 8} // CANCEL_MSG (Leaf)
106+
{0x169, 0, 8, .blocked = true}, // LKAS
107+
{0x2b1, 0, 8, .blocked = true}, // PROPILOT_HUD
108+
{0x4cc, 0, 8, .blocked = true}, // PROPILOT_HUD_INFO_MSG
109+
{0x20b, 2, 6}, // CRUISE_THROTTLE (X-Trail)
110+
{0x20b, 1, 6}, // CRUISE_THROTTLE (Altima)
111+
{0x280, 2, 8, .blocked = true} // CANCEL_MSG (Leaf)
134112
};
135113

136114
// Signals duplicated below due to the fact that these messages can come in on either CAN bus, depending on car model.
@@ -160,5 +138,4 @@ const safety_hooks nissan_hooks = {
160138
.init = nissan_init,
161139
.rx = nissan_rx_hook,
162140
.tx = nissan_tx_hook,
163-
.fwd = nissan_fwd_hook,
164141
};

0 commit comments

Comments
 (0)