send on bus 0

This commit is contained in:
Shane Smiskol 2022-06-13 23:07:02 -07:00
parent 636e5e41b9
commit f90db5d359
2 changed files with 4 additions and 9 deletions

View File

@ -8,7 +8,7 @@
// brake > 0mph // brake > 0mph
const CanMsg HONDA_N_TX_MSGS[] = {{0xE4, 0, 5}, {0x194, 0, 4}, {0x1FA, 0, 8}, {0x200, 0, 6}, {0x30C, 0, 8}, {0x33D, 0, 5}}; const CanMsg HONDA_N_TX_MSGS[] = {{0xE4, 0, 5}, {0x194, 0, 4}, {0x1FA, 0, 8}, {0x200, 0, 6}, {0x30C, 0, 8}, {0x33D, 0, 5}};
const CanMsg HONDA_BOSCH_TX_MSGS[] = {{0xE4, 0, 5}, {0xE5, 0, 8}, {0x296, 1, 4}, {0x33D, 0, 5}, {0x33DA, 0, 5}, {0x33DB, 0, 8}}; // Bosch const CanMsg HONDA_BOSCH_TX_MSGS[] = {{0xE4, 0, 5}, {0xE5, 0, 8}, {0x296, 1, 4}, {0x33D, 0, 5}, {0x33DA, 0, 5}, {0x33DB, 0, 8}}; // Bosch
const CanMsg HONDA_RADARLESS_TX_MSGS[] = {{0xE4, 0, 5}, {0x296, 2, 4}, {0x33D, 0, 8}}; // Bosch radarless const CanMsg HONDA_RADARLESS_TX_MSGS[] = {{0xE4, 0, 5}, {0x296, 0, 4}, {0x33D, 0, 8}}; // Bosch radarless
const CanMsg HONDA_BOSCH_LONG_TX_MSGS[] = {{0xE4, 1, 5}, {0x1DF, 1, 8}, {0x1EF, 1, 8}, {0x1FA, 1, 8}, {0x30C, 1, 8}, {0x33D, 1, 5}, {0x33DA, 1, 5}, {0x33DB, 1, 8}, {0x39F, 1, 8}, {0x18DAB0F1, 1, 8}}; // Bosch w/ gas and brakes const CanMsg HONDA_BOSCH_LONG_TX_MSGS[] = {{0xE4, 1, 5}, {0x1DF, 1, 8}, {0x1EF, 1, 8}, {0x1FA, 1, 8}, {0x30C, 1, 8}, {0x33D, 1, 5}, {0x33DA, 1, 5}, {0x33DB, 1, 8}, {0x39F, 1, 8}, {0x18DAB0F1, 1, 8}}; // Bosch w/ gas and brakes
// panda interceptor threshold needs to be equivalent to openpilot threshold to avoid controls mismatches // panda interceptor threshold needs to be equivalent to openpilot threshold to avoid controls mismatches
@ -273,7 +273,6 @@ static int honda_tx_hook(CANPacket_t *to_send, bool longitudinal_allowed) {
} }
bool current_controls_allowed = controls_allowed && !(pedal_pressed); bool current_controls_allowed = controls_allowed && !(pedal_pressed);
int bus_pt = honda_get_pt_bus(); int bus_pt = honda_get_pt_bus();
int bus_buttons = (honda_bosch_radarless) ? 2 : bus_pt; // the camera controls ACC on radarless Bosch cars
// ACC_HUD: safety check (nidec w/o pedal) // ACC_HUD: safety check (nidec w/o pedal)
if ((addr == 0x30C) && (bus == bus_pt)) { if ((addr == 0x30C) && (bus == bus_pt)) {
@ -356,7 +355,7 @@ static int honda_tx_hook(CANPacket_t *to_send, bool longitudinal_allowed) {
// FORCE CANCEL: safety check only relevant when spamming the cancel button in Bosch HW // FORCE CANCEL: safety check only relevant when spamming the cancel button in Bosch HW
// ensuring that only the cancel button press is sent (VAL 2) when controls are off. // ensuring that only the cancel button press is sent (VAL 2) when controls are off.
// This avoids unintended engagements while still allowing resume spam // This avoids unintended engagements while still allowing resume spam
if ((addr == 0x296) && !current_controls_allowed && (bus == bus_buttons)) { if ((addr == 0x296) && !current_controls_allowed && (bus == bus_pt)) {
if (((GET_BYTE(to_send, 0) >> 5) & 0x7U) != 2U) { if (((GET_BYTE(to_send, 0) >> 5) & 0x7U) != 2U) {
tx = 0; tx = 0;
} }

View File

@ -204,7 +204,6 @@ class HondaBase(common.PandaSafetyTest):
MAX_BRAKE: float = 255 MAX_BRAKE: float = 255
PT_BUS: Optional[int] = None # must be set when inherited PT_BUS: Optional[int] = None # must be set when inherited
STEER_BUS: Optional[int] = None # must be set when inherited STEER_BUS: Optional[int] = None # must be set when inherited
BUTTONS_BUS: Optional[int] = None # must be set when inherited, usually PT_BUS
STANDSTILL_THRESHOLD = 0 STANDSTILL_THRESHOLD = 0
RELAY_MALFUNCTION_ADDR = 0xE4 RELAY_MALFUNCTION_ADDR = 0xE4
@ -259,7 +258,7 @@ class HondaBase(common.PandaSafetyTest):
def _button_msg(self, buttons, main_on=False): def _button_msg(self, buttons, main_on=False):
values = {"CRUISE_BUTTONS": buttons, "COUNTER": self.cnt_button % 4} values = {"CRUISE_BUTTONS": buttons, "COUNTER": self.cnt_button % 4}
self.__class__.cnt_button += 1 self.__class__.cnt_button += 1
return self.packer.make_can_msg_panda("SCM_BUTTONS", self.BUTTONS_BUS, values) return self.packer.make_can_msg_panda("SCM_BUTTONS", self.PT_BUS, values)
def _user_brake_msg(self, brake): def _user_brake_msg(self, brake):
return self._powertrain_data_msg(brake_pressed=brake) return self._powertrain_data_msg(brake_pressed=brake)
@ -295,7 +294,6 @@ class TestHondaNidecSafetyBase(HondaBase):
PT_BUS = 0 PT_BUS = 0
STEER_BUS = 0 STEER_BUS = 0
BUTTONS_BUS = 0
INTERCEPTOR_THRESHOLD = 492 INTERCEPTOR_THRESHOLD = 492
@ -443,7 +441,6 @@ class TestHondaNidecAltInterceptorSafety(TestHondaNidecSafety, common.Intercepto
class TestHondaBoschSafetyBase(HondaBase): class TestHondaBoschSafetyBase(HondaBase):
PT_BUS = 1 PT_BUS = 1
STEER_BUS = 0 STEER_BUS = 0
BUTTONS_BUS = 1
TX_MSGS = [[0xE4, 0], [0xE5, 0], [0x296, 1], [0x33D, 0], [0x33DA, 0], [0x33DB, 0]] TX_MSGS = [[0xE4, 0], [0xE5, 0], [0x296, 1], [0x33D, 0], [0x33DA, 0], [0x33DB, 0]]
FWD_BLACKLISTED_ADDRS = {2: [0xE4, 0xE5, 0x33D, 0x33DA, 0x33DB]} FWD_BLACKLISTED_ADDRS = {2: [0xE4, 0xE5, 0x33D, 0x33DA, 0x33DB]}
@ -569,9 +566,8 @@ class TestHondaBoschLongSafety(HondaButtonEnableBase, TestHondaBoschSafetyBase):
class TestHondaBoschRadarless(HondaPcmEnableBase, TestHondaBoschSafetyBase): class TestHondaBoschRadarless(HondaPcmEnableBase, TestHondaBoschSafetyBase):
PT_BUS = 0 PT_BUS = 0
STEER_BUS = 0 STEER_BUS = 0
BUTTONS_BUS = 2 # camera controls ACC, so send buttons on bus 2
TX_MSGS = [[0xE4, 0], [0x296, 2], [0x33D, 0]] TX_MSGS = [[0xE4, 0], [0x296, 0], [0x33D, 0]]
FWD_BLACKLISTED_ADDRS = {2: [0xE4, 0xE5, 0x33D, 0x33DA, 0x33DB]} FWD_BLACKLISTED_ADDRS = {2: [0xE4, 0xE5, 0x33D, 0x33DA, 0x33DB]}
def setUp(self): def setUp(self):