safety for the testers

rm
This commit is contained in:
Shane Smiskol 2024-02-27 20:41:20 -08:00
parent 4303ae1387
commit d74b197f53
1 changed files with 5 additions and 0 deletions

View File

@ -236,6 +236,11 @@ static bool hyundai_canfd_tx_hook(const CANPacket_t *to_send) {
if (addr == steer_addr) {
int desired_torque = (((GET_BYTE(to_send, 6) & 0xFU) << 7U) | (GET_BYTE(to_send, 5) >> 1U)) - 1024U;
bool steer_req = GET_BIT(to_send, 52U);
int max_torque = GET_BYTE(to_send, 12U);
if (!controls_allowed && (max_torque != 0)) {
tx = false;
}
if (steer_torque_cmd_checks(desired_torque, steer_req, HYUNDAI_CANFD_STEERING_LIMITS)) {
tx = false;