From 89c5a5b60d9e0de852d3cb37d9646a7485415ad6 Mon Sep 17 00:00:00 2001 From: Cameron Clough Date: Fri, 29 Apr 2022 19:57:41 +0100 Subject: [PATCH] fix cruise state bug --- board/safety/safety_ford.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/board/safety/safety_ford.h b/board/safety/safety_ford.h index bdabaad1b8..24a5398944 100644 --- a/board/safety/safety_ford.h +++ b/board/safety/safety_ford.h @@ -96,7 +96,8 @@ static int ford_rx_hook(CANPacket_t *to_push) { brake_pressed = ((GET_BYTE(to_push, 0) & 0x30U) >> 4) == 2U; // Signal: CcStat_D_Actl - bool cruise_engaged = (GET_BYTE(to_push, 1) & 0x07U) == 5U; + unsigned int cruise_state = GET_BYTE(to_push, 1) & 0x07U; + bool cruise_engaged = cruise_state == 4U || cruise_state == 5U; // Enter controls on rising edge of stock ACC, exit controls if stock ACC disengages if (cruise_engaged && !cruise_engaged_prev) {