Skip to content

Commit

Permalink
Honda safety: fixed incorrect brake decoding. Due to the specific lim…
Browse files Browse the repository at this point in the history
…it of 255, this change does not affect the safety behavior
  • Loading branch information
rbiasini committed Aug 23, 2019
1 parent 8843af7 commit 36067e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion board/safety/safety_honda.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {

// BRAKE: safety check
if (addr == 0x1FA) {
int brake = (GET_BYTE(to_send, 0) << 2) + (GET_BYTE(to_send, 1) & 0x3);
int brake = (GET_BYTE(to_send, 0) << 2) + ((GET_BYTE(to_send, 1) >> 6) & 0x3);
if (!current_controls_allowed || !long_controls_allowed) {
if (brake != 0) {
tx = 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/safety/test_honda.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _gas_msg(self, gas):
def _send_brake_msg(self, brake):
to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *')
to_send[0].RIR = 0x1FA << 21
to_send[0].RDLR = ((brake & 0x3) << 8) | ((brake & 0x3FF) >> 2)
to_send[0].RDLR = ((brake & 0x3) << 14) | ((brake & 0x3FF) >> 2)

return to_send

Expand Down

0 comments on commit 36067e0

Please sign in to comment.