Skip to content

Commit 1c9c459

Browse files
committed
do GM
1 parent 4d82389 commit 1c9c459

File tree

1 file changed

+6
-31
lines changed

1 file changed

+6
-31
lines changed

opendbc/safety/safety/safety_gm.h

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -159,32 +159,6 @@ static bool gm_tx_hook(const CANPacket_t *to_send) {
159159
return tx;
160160
}
161161

162-
static int gm_fwd_hook(int bus_num, int addr) {
163-
int bus_fwd = -1;
164-
165-
if (gm_hw == GM_CAM) {
166-
if (bus_num == 0) {
167-
// block PSCMStatus; forwarded through openpilot to hide an alert from the camera
168-
bool is_pscm_msg = (addr == 0x184);
169-
if (!is_pscm_msg) {
170-
bus_fwd = 2;
171-
}
172-
}
173-
174-
if (bus_num == 2) {
175-
// block lkas message and acc messages if gm_cam_long, forward all others
176-
bool is_lkas_msg = (addr == 0x180);
177-
bool is_acc_msg = (addr == 0x315) || (addr == 0x2CB) || (addr == 0x370);
178-
bool block_msg = is_lkas_msg || (is_acc_msg && gm_cam_long);
179-
if (!block_msg) {
180-
bus_fwd = 0;
181-
}
182-
}
183-
}
184-
185-
return bus_fwd;
186-
}
187-
188162
static safety_config gm_init(uint16_t param) {
189163
const uint16_t GM_PARAM_HW_CAM = 1;
190164

@@ -207,8 +181,9 @@ static safety_config gm_init(uint16_t param) {
207181
.max_brake = 400,
208182
};
209183

210-
static const CanMsg GM_CAM_LONG_TX_MSGS[] = {{0x180, 0, 4}, {0x315, 0, 5}, {0x2CB, 0, 8}, {0x370, 0, 6}, // pt bus
211-
{0x184, 2, 8}}; // camera bus
184+
// block PSCMStatus; forwarded through openpilot to hide an alert from the camera
185+
static const CanMsg GM_CAM_LONG_TX_MSGS[] = {{0x180, 0, 4, .blocked = true}, {0x315, 0, 5, .blocked = true}, {0x2CB, 0, 8, .blocked = true}, {0x370, 0, 6, .blocked = true}, // pt bus
186+
{0x184, 2, 8, .blocked = true}}; // camera bus
212187

213188

214189
// TODO: do checksum and counter checks. Add correct timestep, 0.1s for now.
@@ -223,8 +198,9 @@ static safety_config gm_init(uint16_t param) {
223198
{.msg = {{0xC9, 0, 8, .ignore_checksum = true, .ignore_counter = true, .frequency = 10U}, { 0 }, { 0 }}},
224199
};
225200

226-
static const CanMsg GM_CAM_TX_MSGS[] = {{0x180, 0, 4}, // pt bus
227-
{0x1E1, 2, 7}, {0x184, 2, 8}}; // camera bus
201+
// block PSCMStatus; forwarded through openpilot to hide an alert from the camera
202+
static const CanMsg GM_CAM_TX_MSGS[] = {{0x180, 0, 4, .blocked = true}, // pt bus
203+
{0x1E1, 2, 7}, {0x184, 2, 8, .blocked = true}}; // camera bus
228204

229205
gm_hw = GET_FLAG(param, GM_PARAM_HW_CAM) ? GM_CAM : GM_ASCM;
230206

@@ -255,5 +231,4 @@ const safety_hooks gm_hooks = {
255231
.init = gm_init,
256232
.rx = gm_rx_hook,
257233
.tx = gm_tx_hook,
258-
.fwd = gm_fwd_hook,
259234
};

0 commit comments

Comments
 (0)