From 5aaa4d940056b1d60d6c313180cfb25da7bb3a17 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 22 Nov 2023 02:27:00 -0800 Subject: [PATCH 1/2] never checked bus! --- board/safety/safety_nissan.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/board/safety/safety_nissan.h b/board/safety/safety_nissan.h index 1504e39aae..509fa9606a 100644 --- a/board/safety/safety_nissan.h +++ b/board/safety/safety_nissan.h @@ -72,14 +72,14 @@ static void nissan_rx_hook(CANPacket_t *to_push) { gas_pressed = GET_BYTE(to_push, 0) > 3U; } } - } - // X-trail 0x454, Leaf 0x239 - if ((addr == 0x454) || (addr == 0x239)) { - if (addr == 0x454){ - brake_pressed = (GET_BYTE(to_push, 2) & 0x80U) != 0U; - } else { - brake_pressed = ((GET_BYTE(to_push, 4) >> 5) & 1U) != 0U; + // X-trail 0x454, Leaf 0x239 + if ((addr == 0x454) || (addr == 0x239)) { + if (addr == 0x454){ + brake_pressed = (GET_BYTE(to_push, 2) & 0x80U) != 0U; + } else { + brake_pressed = ((GET_BYTE(to_push, 4) >> 5) & 1U) != 0U; + } } } From 4924b22e4cfcc13fbe111d3038c9a42742deba45 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 22 Nov 2023 02:35:55 -0800 Subject: [PATCH 2/2] easy fix --- tests/safety/test_nissan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/safety/test_nissan.py b/tests/safety/test_nissan.py index 3519d287f1..524028d66c 100755 --- a/tests/safety/test_nissan.py +++ b/tests/safety/test_nissan.py @@ -50,7 +50,7 @@ def _speed_msg(self, speed): def _user_brake_msg(self, brake): values = {"USER_BRAKE_PRESSED": brake} - return self.packer.make_can_msg_panda("DOORS_LIGHTS", 1, values) + return self.packer.make_can_msg_panda("DOORS_LIGHTS", self.EPS_BUS, values) def _user_gas_msg(self, gas): values = {"GAS_PEDAL": gas}