Skip to content

Commit 36067e0

Browse files
committed
Honda safety: fixed incorrect brake decoding. Due to the specific limit of 255, this change does not affect the safety behavior
1 parent 8843af7 commit 36067e0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

board/safety/safety_honda.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
103103

104104
// BRAKE: safety check
105105
if (addr == 0x1FA) {
106-
int brake = (GET_BYTE(to_send, 0) << 2) + (GET_BYTE(to_send, 1) & 0x3);
106+
int brake = (GET_BYTE(to_send, 0) << 2) + ((GET_BYTE(to_send, 1) >> 6) & 0x3);
107107
if (!current_controls_allowed || !long_controls_allowed) {
108108
if (brake != 0) {
109109
tx = 0;

tests/safety/test_honda.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def _gas_msg(self, gas):
6464
def _send_brake_msg(self, brake):
6565
to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *')
6666
to_send[0].RIR = 0x1FA << 21
67-
to_send[0].RDLR = ((brake & 0x3) << 8) | ((brake & 0x3FF) >> 2)
67+
to_send[0].RDLR = ((brake & 0x3) << 14) | ((brake & 0x3FF) >> 2)
6868

6969
return to_send
7070

0 commit comments

Comments
 (0)