Skip to content

Commit 649cdd6

Browse files
committed
Rivian is nice and clean
1 parent 4803ade commit 649cdd6

File tree

1 file changed

+4
-42
lines changed

1 file changed

+4
-42
lines changed

opendbc/safety/safety/safety_rivian.h

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -91,50 +91,13 @@ static bool rivian_tx_hook(const CANPacket_t *to_send) {
9191
return tx;
9292
}
9393

94-
static int rivian_fwd_hook(int bus, int addr) {
95-
int bus_fwd = -1;
96-
bool block_msg = false;
97-
98-
if (bus == 0) {
99-
// SCCM_WheelTouch: for hiding hold wheel alert
100-
if (addr == 0x321) {
101-
block_msg = true;
102-
}
103-
104-
// VDM_AdasSts: for canceling stock ACC
105-
if ((addr == 0x162) && !rivian_longitudinal) {
106-
block_msg = true;
107-
}
108-
109-
if (!block_msg) {
110-
bus_fwd = 2;
111-
}
112-
}
113-
114-
if (bus == 2) {
115-
// ACM_lkaHbaCmd: lateral control message
116-
if (addr == 0x120) {
117-
block_msg = true;
118-
}
119-
120-
// ACM_longitudinalRequest: longitudinal control message
121-
if (rivian_longitudinal && (addr == 0x160)) {
122-
block_msg = true;
123-
}
124-
125-
if (!block_msg) {
126-
bus_fwd = 0;
127-
}
128-
}
129-
130-
return bus_fwd;
131-
}
132-
13394
static safety_config rivian_init(uint16_t param) {
95+
// Block SCCM_WheelTouch: for hiding hold wheel alert
96+
// Block VDM_AdasSts: for canceling stock ACC
13497
// 0x120 = ACM_lkaHbaCmd, 0x321 = SCCM_WheelTouch, 0x162 = VDM_AdasSts
135-
static const CanMsg RIVIAN_TX_MSGS[] = {{0x120, 0, 8}, {0x321, 2, 7}, {0x162, 2, 8}};
98+
static const CanMsg RIVIAN_TX_MSGS[] = {{0x120, 0, 8, .blocked = true}, {0x321, 2, 7, .blocked = true}, {0x162, 2, 8, .blocked = true}};
13699
// 0x160 = ACM_longitudinalRequest
137-
static const CanMsg RIVIAN_LONG_TX_MSGS[] = {{0x120, 0, 8}, {0x321, 2, 7}, {0x160, 0, 5}};
100+
static const CanMsg RIVIAN_LONG_TX_MSGS[] = {{0x120, 0, 8, .blocked = true}, {0x321, 2, 7, .blocked = true}, {0x160, 0, 5, .blocked = true}};
138101

139102
static RxCheck rivian_rx_checks[] = {
140103
{.msg = {{0x208, 0, 8, .frequency = 50U, .ignore_checksum = true, .ignore_counter = true}, { 0 }, { 0 }}}, // ESP_Status (speed)
@@ -158,5 +121,4 @@ const safety_hooks rivian_hooks = {
158121
.init = rivian_init,
159122
.rx = rivian_rx_hook,
160123
.tx = rivian_tx_hook,
161-
.fwd = rivian_fwd_hook,
162124
};

0 commit comments

Comments
 (0)