Skip to content

Commit

Permalink
Honda: forwarding CAN0 to camera, so camera can stay on (#139)
Browse files Browse the repository at this point in the history
* Honda: forwarding CAN0 to camera, so camera can stay on

* fwd some honda camera msgs

* add crv and rdx steering msg to honda fwd filter
  • Loading branch information
rbiasini committed Nov 4, 2018
1 parent 4dd3f5a commit 915ee4f
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions board/safety/safety_honda.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,22 +138,27 @@ static void honda_init(int16_t param) {
honda_alt_brake_msg = false;
}

const safety_hooks honda_hooks = {
.init = honda_init,
.rx = honda_rx_hook,
.tx = honda_tx_hook,
.tx_lin = nooutput_tx_lin_hook,
.ignition = default_ign_hook,
.fwd = nooutput_fwd_hook,
};

static void honda_bosch_init(int16_t param) {
controls_allowed = 0;
bosch_hardware = true;
// Checking for alternate brake override from safety parameter
honda_alt_brake_msg = param == 1 ? true : false;
}

static int honda_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
// fwd from car to camera. also fwd certain msgs from camera to car
// 0xE4 is steering on all cars except CRV and RDX. 0x194 for CRV and RDX
int addr = to_fwd->RIR>>21;
if (bus_num == 0) {
return 2;
} else if (bus_num == 2 && addr != 0xE4 && addr != 0x1FA && addr != 0x30C &&
addr != 0x33D && addr != 0x35E && addr != 0x39E && addr != 0x194) {
return 0;
}

return -1;
}

static int honda_bosch_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
if (bus_num == 1 || bus_num == 2) {
int addr = to_fwd->RIR>>21;
Expand All @@ -162,6 +167,15 @@ static int honda_bosch_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
return -1;
}

const safety_hooks honda_hooks = {
.init = honda_init,
.rx = honda_rx_hook,
.tx = honda_tx_hook,
.tx_lin = nooutput_tx_lin_hook,
.ignition = default_ign_hook,
.fwd = honda_fwd_hook,
};

const safety_hooks honda_bosch_hooks = {
.init = honda_bosch_init,
.rx = honda_rx_hook,
Expand Down

0 comments on commit 915ee4f

Please sign in to comment.