Honda safety: fixed incorrect brake decoding. Due to the specific limit of 255, this change does not affect the safety behavior
parent
8843af7de9
commit
36067e01c7
|
@ -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;
|
||||
|
|
|
@ -64,7 +64,7 @@ class TestHondaSafety(unittest.TestCase):
|
|||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue