This commit is contained in:
Your Name
2024-05-21 00:20:54 -05:00
parent 2f9d425859
commit 9aabc7e605

View File

@@ -403,26 +403,26 @@ BO_ 1151 HVAC_TOUCH_BUTTONS: 8 XXX
}
// ACCEL: safety check
if (addr == 0x1a0) {
int desired_accel_raw = (((GET_BYTE(to_send, 17) & 0x7U) << 8) | GET_BYTE(to_send, 16)) - 1023U;
int desired_accel_val = ((GET_BYTE(to_send, 18) << 4) | (GET_BYTE(to_send, 17) >> 4)) - 1023U;
// if (addr == 0x1a0) {
// int desired_accel_raw = (((GET_BYTE(to_send, 17) & 0x7U) << 8) | GET_BYTE(to_send, 16)) - 1023U;
// int desired_accel_val = ((GET_BYTE(to_send, 18) << 4) | (GET_BYTE(to_send, 17) >> 4)) - 1023U;
bool violation = false;
// bool violation = false;
if (hyundai_longitudinal) {
violation |= longitudinal_accel_checks(desired_accel_raw, HYUNDAI_LONG_LIMITS);
violation |= longitudinal_accel_checks(desired_accel_val, HYUNDAI_LONG_LIMITS);
} else {
// only used to cancel on here
if ((desired_accel_raw != 0) || (desired_accel_val != 0)) {
violation = true;
}
}
// if (hyundai_longitudinal) {
// violation |= longitudinal_accel_checks(desired_accel_raw, HYUNDAI_LONG_LIMITS);
// violation |= longitudinal_accel_checks(desired_accel_val, HYUNDAI_LONG_LIMITS);
// } else {
// // only used to cancel on here
// if ((desired_accel_raw != 0) || (desired_accel_val != 0)) {
// violation = true;
// }
// }
if (violation) {
tx = false;
}
}
// if (violation) {
// tx = false;
// }
// }
return tx;
}