Skip to content

Commit 2d2cf25

Browse files
jyoung8607sshane
andauthored
Toyota: Cleanup/fix safety RxChecks for SecOC (#1953)
* Toyota: Cleanup/fix RxChecks for SecOC * oops * fix test_models failure --------- Co-authored-by: Shane Smiskol <[email protected]>
1 parent 248f8be commit 2d2cf25

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

opendbc/safety/safety/safety_toyota.h

+21-8
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,18 @@
2424
#define TOYOTA_COMMON_RX_CHECKS(lta) \
2525
{.msg = {{ 0xaa, 0, 8, .ignore_checksum = true, .ignore_counter = true, .frequency = 83U}, { 0 }, { 0 }}}, \
2626
{.msg = {{0x260, 0, 8, .ignore_counter = true, .quality_flag = (lta), .frequency = 50U}, { 0 }, { 0 }}}, \
27-
{.msg = {{0x1D2, 0, 8, .ignore_counter = true, .frequency = 33U}, \
28-
{0x176, 0, 8, .ignore_counter = true, .frequency = 32U}, { 0 }}}, \
29-
{.msg = {{0x101, 0, 8, .ignore_checksum = true, .ignore_counter = true, .frequency = 50U}, \
30-
{0x224, 0, 8, .ignore_checksum = true, .ignore_counter = true, .frequency = 40U}, \
31-
{0x226, 0, 8, .ignore_checksum = true, .ignore_counter = true, .frequency = 40U}}}, \
27+
28+
#define TOYOTA_RX_CHECKS(lta) \
29+
TOYOTA_COMMON_RX_CHECKS(lta) \
30+
{.msg = {{0x1D2, 0, 8, .ignore_counter = true, .frequency = 33U}, { 0 }, { 0 }}}, \
31+
{.msg = {{0x224, 0, 8, .ignore_checksum = true, .ignore_counter = true, .frequency = 40U}, \
32+
{0x226, 0, 8, .ignore_checksum = true, .ignore_counter = true, .frequency = 40U}, { 0 }}}, \
33+
34+
#define TOYOTA_SECOC_RX_CHECKS \
35+
TOYOTA_COMMON_RX_CHECKS(false) \
36+
{.msg = {{0x176, 0, 8, .ignore_counter = true, .frequency = 32U}, { 0 }, { 0 }}}, \
37+
{.msg = {{0x116, 0, 8, .ignore_checksum = true, .ignore_counter = true, .frequency = 42U}, { 0 }, { 0 }}}, \
38+
{.msg = {{0x101, 0, 8, .ignore_checksum = true, .ignore_counter = true, .frequency = 50U}, { 0 }, { 0 }}}, \
3239

3340
static bool toyota_secoc = false;
3441
static bool toyota_alt_brake = false;
@@ -360,16 +367,22 @@ static safety_config toyota_init(uint16_t param) {
360367
SET_TX_MSGS(TOYOTA_LONG_TX_MSGS, ret);
361368
}
362369

363-
if (toyota_lta) {
370+
if (toyota_secoc) {
371+
static RxCheck toyota_secoc_rx_checks[] = {
372+
TOYOTA_SECOC_RX_CHECKS
373+
};
374+
375+
SET_RX_CHECKS(toyota_secoc_rx_checks, ret);
376+
} else if (toyota_lta) {
364377
// Check the quality flag for angle measurement when using LTA, since it's not set on TSS-P cars
365378
static RxCheck toyota_lta_rx_checks[] = {
366-
TOYOTA_COMMON_RX_CHECKS(true)
379+
TOYOTA_RX_CHECKS(true)
367380
};
368381

369382
SET_RX_CHECKS(toyota_lta_rx_checks, ret);
370383
} else {
371384
static RxCheck toyota_lka_rx_checks[] = {
372-
TOYOTA_COMMON_RX_CHECKS(false)
385+
TOYOTA_RX_CHECKS(false)
373386
};
374387

375388
SET_RX_CHECKS(toyota_lka_rx_checks, ret);

0 commit comments

Comments
 (0)