Skip to content

Commit dd10a83

Browse files
authored
Hyundai longitudinal: handle mid-press button change (commaai#24674)
* send additional button event for previous if we switch buttons mid-press * add comment * remove * comment
1 parent 86f73a5 commit dd10a83

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

selfdrive/car/hyundai/interface.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,12 @@ def _update(self, c):
341341
events.add(EventName.brakeUnavailable)
342342

343343
if self.CS.CP.openpilotLongitudinalControl and self.CS.cruise_buttons[-1] != self.CS.prev_cruise_buttons:
344-
ret.buttonEvents = [create_button_event(self.CS.cruise_buttons[-1], self.CS.prev_cruise_buttons, BUTTONS_DICT)]
344+
buttonEvents = [create_button_event(self.CS.cruise_buttons[-1], self.CS.prev_cruise_buttons, BUTTONS_DICT)]
345+
# Handle CF_Clu_CruiseSwState changing buttons mid-press
346+
if self.CS.cruise_buttons[-1] != 0 and self.CS.prev_cruise_buttons != 0:
347+
buttonEvents.append(create_button_event(0, self.CS.prev_cruise_buttons, BUTTONS_DICT))
345348

349+
ret.buttonEvents = buttonEvents
346350
events.events.extend(create_button_enable_events(ret.buttonEvents))
347351

348352
# low speed steer alert hysteresis logic (only for cars with steer cut off above 10 m/s)

0 commit comments

Comments
 (0)