diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index 9406d858..0fd4b203 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -168,12 +168,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"]) - 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})] + # 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) return ret @@ -248,7 +248,6 @@ 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"] @@ -258,8 +257,9 @@ 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"]) - 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})] + # 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) return ret