Skip to content

Commit

Permalink
Toyota: check ACC_CONTROL for relay malfunction (commaai#1870)
Browse files Browse the repository at this point in the history
* check acc relay malfunction

* do what they do
  • Loading branch information
sshane authored Feb 15, 2024
1 parent ef68fea commit 27768f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion board/safety/safety_toyota.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,11 @@ static void toyota_rx_hook(const CANPacket_t *to_push) {
gas_interceptor_prev = gas_interceptor;
}

generic_rx_checks((addr == 0x2E4));
bool stock_ecu_detected = addr == 0x2E4; // STEERING_LKA
if (!toyota_stock_longitudinal && (addr == 0x343)) {
stock_ecu_detected = true; // ACC_CONTROL
}
generic_rx_checks(stock_ecu_detected);
}
}

Expand Down
5 changes: 3 additions & 2 deletions tests/safety/test_toyota.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TestToyotaSafetyBase(common.PandaCarSafetyTest, common.LongitudinalAccelSa

TX_MSGS = TOYOTA_COMMON_TX_MSGS
STANDSTILL_THRESHOLD = 0 # kph
RELAY_MALFUNCTION_ADDRS = {0: (0x2E4,)}
RELAY_MALFUNCTION_ADDRS = {0: (0x2E4, 0x343)}
FWD_BLACKLISTED_ADDRS = {2: [0x2E4, 0x412, 0x191, 0x343]}
FWD_BUS_LOOKUP = {0: 2, 2: 0}
EPS_SCALE = 73
Expand Down Expand Up @@ -311,7 +311,8 @@ class TestToyotaAltBrakeSafetyGasInterceptor(TestToyotaSafetyGasInterceptorBase,

class TestToyotaStockLongitudinalBase(TestToyotaSafetyBase):

# Base fwd addresses minus ACC_CONTROL (0x343)
# Base addresses minus ACC_CONTROL (0x343)
RELAY_MALFUNCTION_ADDRS = {0: (0x2E4,)}
FWD_BLACKLISTED_ADDRS = {2: [0x2E4, 0x412, 0x191]}

def test_accel_actuation_limits(self, stock_longitudinal=True):
Expand Down

0 comments on commit 27768f5

Please sign in to comment.