Skip to content

Commit

Permalink
Hyundai: Synchronize flag names
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyhaibin committed Dec 10, 2024
1 parent bedee40 commit 965081f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
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

0 comments on commit 965081f

Please sign in to comment.