This commit is contained in:
Your Name
2024-05-12 21:56:49 -05:00
parent b4120aed2e
commit d228405bc8
4 changed files with 14 additions and 14 deletions

View File

@@ -213,6 +213,7 @@ class CarController(CarControllerBase):
elif CC.cruiseControl.resume:
if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS:
# TODO: resume for alt button cars
print (CS.cruise_can_msg)
CS.lkas_trigger_result = 3
pass
else:

View File

@@ -273,6 +273,8 @@ class CarState(CarStateBase):
if self.CP.flags & HyundaiFlags.EV:
ret.cruiseState.nonAdaptive = cp.vl["MANUAL_SPEED_LIMIT_ASSIST"]["MSLA_ENABLED"] == 1
self.cruise_can_msg = copy.copy(cp.vl_all[self.cruise_btns_msg_canfd])
self.prev_cruise_buttons = self.cruise_buttons[-1]
self.cruise_buttons.extend(cp.vl_all[self.cruise_btns_msg_canfd]["CRUISE_BUTTONS"])
self.prev_main_buttons = self.main_buttons[-1]

View File

@@ -161,11 +161,12 @@ class CarInterface(CarInterfaceBase):
def _update(self, c, frogpilot_variables):
ret = self.CS.update(self.cp, self.cp_cam, frogpilot_variables)
if self.CS.CP.openpilotLongitudinalControl:
ret.buttonEvents = [
*create_button_events(self.CS.cruise_buttons[-1], self.CS.prev_cruise_buttons, BUTTONS_DICT),
*create_button_events(self.CS.lkas_enabled, self.CS.lkas_previously_enabled, {1: FrogPilotButtonType.lkas}),
]
# todo: this check probably needs to be removed on other cars
# if self.CS.CP.openpilotLongitudinalControl:
ret.buttonEvents = [
*create_button_events(self.CS.cruise_buttons[-1], self.CS.prev_cruise_buttons, BUTTONS_DICT),
*create_button_events(self.CS.lkas_enabled, self.CS.lkas_previously_enabled, {1: FrogPilotButtonType.lkas}),
]
# On some newer model years, the CANCEL button acts as a pause/resume button based on the PCM state
# To avoid re-engaging when openpilot cancels, check user engagement intention via buttons

View File

@@ -1233,15 +1233,11 @@ class Controls:
if (len(CS.buttonEvents) > 0):
print (CS.buttonEvents)
if any(be.pressed and be.type == FrogPilotButtonType.lkas for be in CS.buttonEvents):
exit() # Just cause a crash for testing
self.events.add(EventName.clpDebug)
# clearpilot_notice(CP_NOTICE_DEBUG, "LKAS Debug Action Invoked")
foo = "bar"
def clearpilot_state_control(self, CC, CS):
foo = "bar"
if any(be.pressed and be.type == FrogPilotButtonType.lkas for be in CS.buttonEvents):
CC.cruiseControl.resume = True
return CC
def main():