Subaru: rename legacy to preglobal (#1415)

* rename

* missing some variables

* fix find/replace error
This commit is contained in:
Justin Newberry 2023-05-15 20:22:40 -04:00 committed by GitHub
parent f95f4a5294
commit 0a738b7ee8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 26 deletions

View File

@ -11,7 +11,7 @@
#include "safety/safety_hyundai.h" #include "safety/safety_hyundai.h"
#include "safety/safety_chrysler.h" #include "safety/safety_chrysler.h"
#include "safety/safety_subaru.h" #include "safety/safety_subaru.h"
#include "safety/safety_subaru_legacy.h" #include "safety/safety_subaru_preglobal.h"
#include "safety/safety_mazda.h" #include "safety/safety_mazda.h"
#include "safety/safety_nissan.h" #include "safety/safety_nissan.h"
#include "safety/safety_volkswagen_mqb.h" #include "safety/safety_volkswagen_mqb.h"
@ -44,7 +44,7 @@
#define SAFETY_NOOUTPUT 19U #define SAFETY_NOOUTPUT 19U
#define SAFETY_HONDA_BOSCH 20U #define SAFETY_HONDA_BOSCH 20U
#define SAFETY_VOLKSWAGEN_PQ 21U #define SAFETY_VOLKSWAGEN_PQ 21U
#define SAFETY_SUBARU_LEGACY 22U #define SAFETY_SUBARU_PREGLOBAL 22U
#define SAFETY_HYUNDAI_LEGACY 23U #define SAFETY_HYUNDAI_LEGACY 23U
#define SAFETY_HYUNDAI_COMMUNITY 24U #define SAFETY_HYUNDAI_COMMUNITY 24U
#define SAFETY_STELLANTIS 25U #define SAFETY_STELLANTIS 25U
@ -313,7 +313,7 @@ const safety_hook_config safety_hook_registry[] = {
#endif #endif
#ifdef ALLOW_DEBUG #ifdef ALLOW_DEBUG
{SAFETY_TESLA, &tesla_hooks}, {SAFETY_TESLA, &tesla_hooks},
{SAFETY_SUBARU_LEGACY, &subaru_legacy_hooks}, {SAFETY_SUBARU_PREGLOBAL, &subaru_preglobal_hooks},
{SAFETY_VOLKSWAGEN_PQ, &volkswagen_pq_hooks}, {SAFETY_VOLKSWAGEN_PQ, &volkswagen_pq_hooks},
{SAFETY_ALLOUTPUT, &alloutput_hooks}, {SAFETY_ALLOUTPUT, &alloutput_hooks},
#endif #endif

View File

@ -1,4 +1,4 @@
const SteeringLimits SUBARU_L_STEERING_LIMITS = { const SteeringLimits SUBARU_PG_STEERING_LIMITS = {
.max_steer = 2047, .max_steer = 2047,
.max_rt_delta = 940, .max_rt_delta = 940,
.max_rt_interval = 250000, .max_rt_interval = 250000,
@ -9,24 +9,24 @@ const SteeringLimits SUBARU_L_STEERING_LIMITS = {
.type = TorqueDriverLimited, .type = TorqueDriverLimited,
}; };
const CanMsg SUBARU_L_TX_MSGS[] = { const CanMsg SUBARU_PG_TX_MSGS[] = {
{0x161, 0, 8}, {0x161, 0, 8},
{0x164, 0, 8} {0x164, 0, 8}
}; };
#define SUBARU_L_TX_MSGS_LEN (sizeof(SUBARU_L_TX_MSGS) / sizeof(SUBARU_L_TX_MSGS[0])) #define SUBARU_PG_TX_MSGS_LEN (sizeof(SUBARU_PG_TX_MSGS) / sizeof(SUBARU_PG_TX_MSGS[0]))
// TODO: do checksum and counter checks after adding the signals to the outback dbc file // TODO: do checksum and counter checks after adding the signals to the outback dbc file
AddrCheckStruct subaru_l_addr_checks[] = { AddrCheckStruct subaru_preglobal_addr_checks[] = {
{.msg = {{0x140, 0, 8, .expected_timestep = 10000U}, { 0 }, { 0 }}}, {.msg = {{0x140, 0, 8, .expected_timestep = 10000U}, { 0 }, { 0 }}},
{.msg = {{0x371, 0, 8, .expected_timestep = 20000U}, { 0 }, { 0 }}}, {.msg = {{0x371, 0, 8, .expected_timestep = 20000U}, { 0 }, { 0 }}},
{.msg = {{0x144, 0, 8, .expected_timestep = 50000U}, { 0 }, { 0 }}}, {.msg = {{0x144, 0, 8, .expected_timestep = 50000U}, { 0 }, { 0 }}},
}; };
#define SUBARU_L_ADDR_CHECK_LEN (sizeof(subaru_l_addr_checks) / sizeof(subaru_l_addr_checks[0])) #define SUBARU_PG_ADDR_CHECK_LEN (sizeof(subaru_preglobal_addr_checks) / sizeof(subaru_preglobal_addr_checks[0]))
addr_checks subaru_l_rx_checks = {subaru_l_addr_checks, SUBARU_L_ADDR_CHECK_LEN}; addr_checks subaru_preglobal_rx_checks = {subaru_preglobal_addr_checks, SUBARU_PG_ADDR_CHECK_LEN};
static int subaru_legacy_rx_hook(CANPacket_t *to_push) { static int subaru_preglobal_rx_hook(CANPacket_t *to_push) {
bool valid = addr_safety_check(to_push, &subaru_l_rx_checks, NULL, NULL, NULL, NULL); bool valid = addr_safety_check(to_push, &subaru_preglobal_rx_checks, NULL, NULL, NULL, NULL);
if (valid && (GET_BUS(to_push) == 0U)) { if (valid && (GET_BUS(to_push) == 0U)) {
int addr = GET_ADDR(to_push); int addr = GET_ADDR(to_push);
@ -61,12 +61,12 @@ static int subaru_legacy_rx_hook(CANPacket_t *to_push) {
return valid; return valid;
} }
static int subaru_legacy_tx_hook(CANPacket_t *to_send) { static int subaru_preglobal_tx_hook(CANPacket_t *to_send) {
int tx = 1; int tx = 1;
int addr = GET_ADDR(to_send); int addr = GET_ADDR(to_send);
if (!msg_allowed(to_send, SUBARU_L_TX_MSGS, SUBARU_L_TX_MSGS_LEN)) { if (!msg_allowed(to_send, SUBARU_PG_TX_MSGS, SUBARU_PG_TX_MSGS_LEN)) {
tx = 0; tx = 0;
} }
@ -75,7 +75,7 @@ static int subaru_legacy_tx_hook(CANPacket_t *to_send) {
int desired_torque = ((GET_BYTES(to_send, 0, 4) >> 8) & 0x1FFFU); int desired_torque = ((GET_BYTES(to_send, 0, 4) >> 8) & 0x1FFFU);
desired_torque = -1 * to_signed(desired_torque, 13); desired_torque = -1 * to_signed(desired_torque, 13);
if (steer_torque_cmd_checks(desired_torque, -1, SUBARU_L_STEERING_LIMITS)) { if (steer_torque_cmd_checks(desired_torque, -1, SUBARU_PG_STEERING_LIMITS)) {
tx = 0; tx = 0;
} }
@ -83,7 +83,7 @@ static int subaru_legacy_tx_hook(CANPacket_t *to_send) {
return tx; return tx;
} }
static int subaru_legacy_fwd_hook(int bus_num, int addr) { static int subaru_preglobal_fwd_hook(int bus_num, int addr) {
int bus_fwd = -1; int bus_fwd = -1;
if (bus_num == 0) { if (bus_num == 0) {
@ -103,15 +103,15 @@ static int subaru_legacy_fwd_hook(int bus_num, int addr) {
return bus_fwd; return bus_fwd;
} }
static const addr_checks* subaru_legacy_init(uint16_t param) { static const addr_checks* subaru_preglobal_init(uint16_t param) {
UNUSED(param); UNUSED(param);
return &subaru_l_rx_checks; return &subaru_preglobal_rx_checks;
} }
const safety_hooks subaru_legacy_hooks = { const safety_hooks subaru_preglobal_hooks = {
.init = subaru_legacy_init, .init = subaru_preglobal_init,
.rx = subaru_legacy_rx_hook, .rx = subaru_preglobal_rx_hook,
.tx = subaru_legacy_tx_hook, .tx = subaru_preglobal_tx_hook,
.tx_lin = nooutput_tx_lin_hook, .tx_lin = nooutput_tx_lin_hook,
.fwd = subaru_legacy_fwd_hook, .fwd = subaru_preglobal_fwd_hook,
}; };

View File

@ -150,7 +150,7 @@ class Panda:
SAFETY_NOOUTPUT = 19 SAFETY_NOOUTPUT = 19
SAFETY_HONDA_BOSCH = 20 SAFETY_HONDA_BOSCH = 20
SAFETY_VOLKSWAGEN_PQ = 21 SAFETY_VOLKSWAGEN_PQ = 21
SAFETY_SUBARU_LEGACY = 22 SAFETY_SUBARU_PREGLOBAL = 22
SAFETY_HYUNDAI_LEGACY = 23 SAFETY_HYUNDAI_LEGACY = 23
SAFETY_HYUNDAI_COMMUNITY = 24 SAFETY_HYUNDAI_COMMUNITY = 24
SAFETY_STELLANTIS = 25 SAFETY_STELLANTIS = 25

View File

@ -6,7 +6,7 @@ import panda.tests.safety.common as common
from panda.tests.safety.common import CANPackerPanda from panda.tests.safety.common import CANPackerPanda
class TestSubaruLegacySafety(common.PandaSafetyTest, common.DriverTorqueSteeringSafetyTest): class TestSubaruPreglobalSafety(common.PandaSafetyTest, common.DriverTorqueSteeringSafetyTest):
TX_MSGS = [[0x161, 0], [0x164, 0]] TX_MSGS = [[0x161, 0], [0x164, 0]]
STANDSTILL_THRESHOLD = 0 # kph STANDSTILL_THRESHOLD = 0 # kph
RELAY_MALFUNCTION_ADDR = 0x164 RELAY_MALFUNCTION_ADDR = 0x164
@ -27,7 +27,7 @@ class TestSubaruLegacySafety(common.PandaSafetyTest, common.DriverTorqueSteering
def setUp(self): def setUp(self):
self.packer = CANPackerPanda("subaru_outback_2015_generated") self.packer = CANPackerPanda("subaru_outback_2015_generated")
self.safety = libpanda_py.libpanda self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_SUBARU_LEGACY, 0) self.safety.set_safety_hooks(Panda.SAFETY_SUBARU_PREGLOBAL, 0)
self.safety.init_tests() self.safety.init_tests()
def _set_prev_torque(self, t): def _set_prev_torque(self, t):

View File

@ -28,7 +28,7 @@ logs = [
ReplayRoute("fbbfa6af821552b9|2020-03-03--08-09-43.bz2", Panda.SAFETY_NISSAN), # NISSAN.XTRAIL ReplayRoute("fbbfa6af821552b9|2020-03-03--08-09-43.bz2", Panda.SAFETY_NISSAN), # NISSAN.XTRAIL
ReplayRoute("5b7c365c50084530_2020-04-15--16-13-24--3--rlog.bz2", Panda.SAFETY_HYUNDAI), # HYUNDAI.SONATA ReplayRoute("5b7c365c50084530_2020-04-15--16-13-24--3--rlog.bz2", Panda.SAFETY_HYUNDAI), # HYUNDAI.SONATA
ReplayRoute("610ebb9faaad6b43|2020-06-13--15-28-36.bz2", Panda.SAFETY_HYUNDAI_LEGACY), # HYUNDAI.IONIQ_EV_LTD ReplayRoute("610ebb9faaad6b43|2020-06-13--15-28-36.bz2", Panda.SAFETY_HYUNDAI_LEGACY), # HYUNDAI.IONIQ_EV_LTD
ReplayRoute("5ab784f361e19b78_2020-06-08--16-30-41.bz2", Panda.SAFETY_SUBARU_LEGACY), # SUBARU.OUTBACK_PREGLOBAL ReplayRoute("5ab784f361e19b78_2020-06-08--16-30-41.bz2", Panda.SAFETY_SUBARU_PREGLOBAL), # SUBARU.OUTBACK_PREGLOBAL
ReplayRoute("bb50caf5f0945ab1|2021-06-19--17-20-18.bz2", Panda.SAFETY_TESLA), # TESLA.AP2_MODELS ReplayRoute("bb50caf5f0945ab1|2021-06-19--17-20-18.bz2", Panda.SAFETY_TESLA), # TESLA.AP2_MODELS
ReplayRoute("bd6a637565e91581_2021-10-29--22-18-31--1--rlog.bz2", Panda.SAFETY_MAZDA), # MAZDA.CX9_2021 ReplayRoute("bd6a637565e91581_2021-10-29--22-18-31--1--rlog.bz2", Panda.SAFETY_MAZDA), # MAZDA.CX9_2021
ReplayRoute("1a5d045d2c531a6d_2022-06-07--22-03-00--1--rlog.bz2", Panda.SAFETY_HONDA_BOSCH, # HONDA.CIVIC_2022 ReplayRoute("1a5d045d2c531a6d_2022-06-07--22-03-00--1--rlog.bz2", Panda.SAFETY_HONDA_BOSCH, # HONDA.CIVIC_2022