Skip to content

Commit

Permalink
VW PQ: Check steer req bit (#1630)
Browse files Browse the repository at this point in the history
* vw pq

* misra
  • Loading branch information
jnewb1 committed Sep 11, 2023
1 parent 428b303 commit d4e63da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion board/safety/safety_volkswagen_pq.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,10 @@ static int volkswagen_pq_tx_hook(CANPacket_t *to_send) {
desired_torque *= -1;
}

if (steer_torque_cmd_checks(desired_torque, -1, VOLKSWAGEN_PQ_STEERING_LIMITS)) {
uint32_t hca_status = ((GET_BYTE(to_send, 1) >> 4) & 0xFU);
bool steer_req = (hca_status == 5U);

if (steer_torque_cmd_checks(desired_torque, steer_req, VOLKSWAGEN_PQ_STEERING_LIMITS)) {
tx = 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/safety/test_volkswagen_pq.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def _torque_driver_msg(self, torque):

# openpilot steering output torque
def _torque_cmd_msg(self, torque, steer_req=1):
values = {"LM_Offset": abs(torque), "LM_OffSign": torque < 0}
values = {"LM_Offset": abs(torque), "LM_OffSign": torque < 0, "HCA_Status": 5 if steer_req else 3}
return self.packer.make_can_msg_panda("HCA_1", 0, values)

# ACC engagement and brake light switch status
Expand Down

0 comments on commit d4e63da

Please sign in to comment.