diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index 0e90357b..8e32a91c 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -171,12 +171,12 @@ class CarState(CarStateBase): self.clu11 = copy.copy(cp.vl["CLU11"]) self.steer_state = cp.vl["MDPS12"]["CF_Mdps_ToiActive"] # 0 NOT ACTIVE, 1 ACTIVE prev_cruise_buttons = self.cruise_buttons[-1] + prev_main_buttons = self.main_buttons[-1] self.cruise_buttons.extend(cp.vl_all["CLU11"]["CF_Clu_CruiseSwState"]) self.main_buttons.extend(cp.vl_all["CLU11"]["CF_Clu_CruiseSwMain"]) - # TODO: always publish buttons. the pause/resume button is classified as cancel on some cars - if self.CP.openpilotLongitudinalControl: - ret.buttonEvents = create_button_events(self.cruise_buttons[-1], prev_cruise_buttons, BUTTONS_DICT) + ret.buttonEvents = [*create_button_events(self.cruise_buttons[-1], prev_cruise_buttons, BUTTONS_DICT), + *create_button_events(self.main_buttons[-1], prev_main_buttons, {1: ButtonType.mainCruise})] return ret @@ -254,6 +254,7 @@ class CarState(CarStateBase): ret.cruiseState.nonAdaptive = cp.vl["MANUAL_SPEED_LIMIT_ASSIST"]["MSLA_ENABLED"] == 1 prev_cruise_buttons = self.cruise_buttons[-1] + prev_main_buttons = self.main_buttons[-1] self.cruise_buttons.extend(cp.vl_all[self.cruise_btns_msg_canfd]["CRUISE_BUTTONS"]) self.main_buttons.extend(cp.vl_all[self.cruise_btns_msg_canfd]["ADAPTIVE_CRUISE_MAIN_BTN"]) self.buttons_counter = cp.vl[self.cruise_btns_msg_canfd]["COUNTER"] @@ -263,9 +264,8 @@ class CarState(CarStateBase): self.hda2_lfa_block_msg = copy.copy(cp_cam.vl["CAM_0x362"] if self.CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING else cp_cam.vl["CAM_0x2a4"]) - # TODO: always publish buttons. the pause/resume button is classified as cancel on some cars - if self.CP.openpilotLongitudinalControl: - ret.buttonEvents = create_button_events(self.cruise_buttons[-1], prev_cruise_buttons, BUTTONS_DICT) + ret.buttonEvents = [*create_button_events(self.cruise_buttons[-1], prev_cruise_buttons, BUTTONS_DICT), + *create_button_events(self.main_buttons[-1], prev_main_buttons, {1: ButtonType.mainCruise})] return ret