Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyundai: Synchronize flag names #2101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions board/safety/safety_hyundai_canfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ static int hyundai_canfd_fwd_hook(int bus_num, int addr) {
}

static safety_config hyundai_canfd_init(uint16_t param) {
const int HYUNDAI_PARAM_CANFD_HDA2_ALT_STEERING = 128;
const int HYUNDAI_PARAM_CANFD_ALT_BUTTONS = 32;
const int FLAG_HYUNDAI_CANFD_HDA2_ALT_STEERING = 128;
const int FLAG_HYUNDAI_CANFD_ALT_BUTTONS = 32;

static const CanMsg HYUNDAI_CANFD_HDA2_TX_MSGS[] = {
{0x50, 0, 16}, // LKAS
Expand Down Expand Up @@ -267,8 +267,8 @@ static safety_config hyundai_canfd_init(uint16_t param) {
hyundai_common_init(param);

gen_crc_lookup_table_16(0x1021, hyundai_canfd_crc_lut);
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);
hyundai_canfd_alt_buttons = GET_FLAG(param, FLAG_HYUNDAI_CANFD_ALT_BUTTONS);
hyundai_canfd_hda2_alt_steering = GET_FLAG(param, FLAG_HYUNDAI_CANFD_HDA2_ALT_STEERING);

// no long for radar-SCC HDA1 yet
if (!hyundai_canfd_hda2 && !hyundai_camera_scc) {
Expand Down
26 changes: 13 additions & 13 deletions board/safety/safety_hyundai_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ bool hyundai_alt_limits = false;
static uint8_t hyundai_last_button_interaction; // button messages since the user pressed an enable button

void hyundai_common_init(uint16_t param) {
const int HYUNDAI_PARAM_EV_GAS = 1;
const int HYUNDAI_PARAM_HYBRID_GAS = 2;
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

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);
const int FLAG_HYUNDAI_EV_GAS = 1;
const int FLAG_HYUNDAI_HYBRID_GAS = 2;
const int FLAG_HYUNDAI_CAMERA_SCC = 8;
const int FLAG_HYUNDAI_CANFD_HDA2 = 16;
const int FLAG_HYUNDAI_ALT_LIMITS = 64; // TODO: shift this down with the rest of the common flags

hyundai_ev_gas_signal = GET_FLAG(param, FLAG_HYUNDAI_EV_GAS);
hyundai_hybrid_gas_signal = !hyundai_ev_gas_signal && GET_FLAG(param, FLAG_HYUNDAI_HYBRID_GAS);
hyundai_camera_scc = GET_FLAG(param, FLAG_HYUNDAI_CAMERA_SCC);
hyundai_canfd_hda2 = GET_FLAG(param, FLAG_HYUNDAI_CANFD_HDA2);
hyundai_alt_limits = GET_FLAG(param, FLAG_HYUNDAI_ALT_LIMITS);

hyundai_last_button_interaction = HYUNDAI_PREV_BUTTON_SAMPLES;

#ifdef ALLOW_DEBUG
const int HYUNDAI_PARAM_LONGITUDINAL = 4;
hyundai_longitudinal = GET_FLAG(param, HYUNDAI_PARAM_LONGITUDINAL);
const int FLAG_HYUNDAI_LONG = 4;
hyundai_longitudinal = GET_FLAG(param, FLAG_HYUNDAI_LONG);
#else
hyundai_longitudinal = false;
#endif
Expand Down
Loading