From 336d98c608d1286b0de1910570aa1119d0ff404f Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Tue, 5 Sep 2023 00:33:12 -0400 Subject: [PATCH] Hyundai CAN-FD: move HDA2 flag to common Hyundai safety --- board/safety/safety_hyundai_canfd.h | 3 --- board/safety/safety_hyundai_common.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/board/safety/safety_hyundai_canfd.h b/board/safety/safety_hyundai_canfd.h index 3ea7a486a5..9a933cc71c 100644 --- a/board/safety/safety_hyundai_canfd.h +++ b/board/safety/safety_hyundai_canfd.h @@ -120,10 +120,8 @@ addr_checks hyundai_canfd_rx_checks = {hyundai_canfd_addr_checks, HYUNDAI_CANFD_ uint16_t hyundai_canfd_crc_lut[256]; -const int HYUNDAI_PARAM_CANFD_HDA2 = 16; const int HYUNDAI_PARAM_CANFD_ALT_BUTTONS = 32; const int HYUNDAI_PARAM_CANFD_HDA2_ALT_STEERING = 128; -bool hyundai_canfd_hda2 = false; bool hyundai_canfd_alt_buttons = false; bool hyundai_canfd_hda2_alt_steering = false; @@ -359,7 +357,6 @@ static const addr_checks* hyundai_canfd_init(uint16_t param) { hyundai_common_init(param); gen_crc_lookup_table_16(0x1021, hyundai_canfd_crc_lut); - hyundai_canfd_hda2 = GET_FLAG(param, HYUNDAI_PARAM_CANFD_HDA2); hyundai_canfd_alt_buttons = GET_FLAG(param, HYUNDAI_PARAM_CANFD_ALT_BUTTONS); hyundai_canfd_hda2_alt_steering = GET_FLAG(param, HYUNDAI_PARAM_CANFD_HDA2_ALT_STEERING); diff --git a/board/safety/safety_hyundai_common.h b/board/safety/safety_hyundai_common.h index 7d16b83bee..34974a4a64 100644 --- a/board/safety/safety_hyundai_common.h +++ b/board/safety/safety_hyundai_common.h @@ -5,6 +5,7 @@ const int HYUNDAI_PARAM_EV_GAS = 1; const int HYUNDAI_PARAM_HYBRID_GAS = 2; const int HYUNDAI_PARAM_LONGITUDINAL = 4; const int HYUNDAI_PARAM_CAMERA_SCC = 8; +const int HYUNDAI_PARAM_CANFD_HDA2 = 16; const int HYUNDAI_PARAM_ALT_LIMITS = 64; // TODO: shift this down with the rest of the common flags const uint8_t HYUNDAI_PREV_BUTTON_SAMPLES = 8; // roughly 160 ms @@ -22,6 +23,7 @@ bool hyundai_ev_gas_signal = false; bool hyundai_hybrid_gas_signal = false; bool hyundai_longitudinal = false; bool hyundai_camera_scc = false; +bool hyundai_canfd_hda2 = false; bool hyundai_alt_limits = false; uint8_t hyundai_last_button_interaction; // button messages since the user pressed an enable button @@ -29,6 +31,7 @@ void hyundai_common_init(uint16_t param) { hyundai_ev_gas_signal = GET_FLAG(param, HYUNDAI_PARAM_EV_GAS); hyundai_hybrid_gas_signal = !hyundai_ev_gas_signal && GET_FLAG(param, HYUNDAI_PARAM_HYBRID_GAS); hyundai_camera_scc = GET_FLAG(param, HYUNDAI_PARAM_CAMERA_SCC); + hyundai_canfd_hda2 = GET_FLAG(param, HYUNDAI_PARAM_CANFD_HDA2); hyundai_alt_limits = GET_FLAG(param, HYUNDAI_PARAM_ALT_LIMITS); hyundai_last_button_interaction = HYUNDAI_PREV_BUTTON_SAMPLES;