Hyundai CAN FD: fix PCM cruise check (#1584)

* add pcm

* fix

* NA

* explicitly check cruise status

* comment and misra
This commit is contained in:
Shane Smiskol 2023-08-16 00:08:07 -07:00 committed by GitHub
parent 8bd3e93813
commit b25810670e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -226,7 +226,9 @@ static int hyundai_canfd_rx_hook(CANPacket_t *to_push) {
if (valid && (bus == scc_bus)) {
// cruise state
if ((addr == 0x1a0) && !hyundai_longitudinal) {
bool cruise_engaged = ((GET_BYTE(to_push, 8) >> 4) & 0x3U) != 0U;
// 1=enabled, 2=driver override
int cruise_status = ((GET_BYTE(to_push, 8) >> 4) & 0x7U);
bool cruise_engaged = (cruise_status == 1) || (cruise_status == 2);
hyundai_common_cruise_state_check(cruise_engaged);
}
}