Subaru: consider true angle sign in safety (#1681)

* this fails

* this doesn't!
This commit is contained in:
Shane Smiskol 2023-10-03 02:18:10 -07:00 committed by GitHub
parent 9fd1b268b4
commit 635db84095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -159,7 +159,7 @@ static int subaru_rx_hook(CANPacket_t *to_push) {
int angle_meas_new = (GET_BYTES(to_push, 4, 2) & 0xFFFFU);
// convert Steering_Torque -> Steering_Angle to centidegrees, to match the ES_LKAS_ANGLE angle request units
angle_meas_new = ROUND(to_signed(angle_meas_new, 16) * 2.17);
angle_meas_new = ROUND(to_signed(angle_meas_new, 16) * -2.17);
update_sample(&angle_meas, angle_meas_new);
}
@ -232,7 +232,7 @@ static int subaru_tx_hook(CANPacket_t *to_send) {
if (addr == MSG_SUBARU_ES_Distance) {
int cruise_throttle = (GET_BYTES(to_send, 2, 2) & 0xFFFU);
bool cruise_cancel = GET_BIT(to_send, 56U) != 0U;
if (subaru_longitudinal) {
violation |= longitudinal_gas_checks(cruise_throttle, SUBARU_LONG_LIMITS);
} else {

View File

@ -69,7 +69,7 @@ class TestSubaruSafetyBase(common.PandaSafetyTest, MeasurementSafetyTest):
ALT_MAIN_BUS = SUBARU_MAIN_BUS
ALT_CAM_BUS = SUBARU_CAM_BUS
DEG_TO_CAN = -100
DEG_TO_CAN = 100
INACTIVE_GAS = 1818