Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyundai: Parse LFA button from steering wheel #1274

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

sunnyhaibin
Copy link
Contributor

@sunnyhaibin sunnyhaibin commented Sep 24, 2024

Description

Parse the physical LFA button from the steering wheel for Hyundai/Kia/Genesis cars with existing signals defined in the DBC.

CAN: Platforms with message 0x391
CAN-FD: All platforms

Requires

@github-actions github-actions bot added car related to opendbc/car/ hyundai labels Sep 24, 2024
Comment on lines 177 to 180
ret.buttonEvents = [
*(create_button_events(self.cruise_buttons[-1], prev_cruise_buttons, BUTTONS_DICT) if self.CP.openpilotLongitudinalControl else []),
*create_button_events(self.lfa_button, prev_lfa_button, {1: ButtonType.altButton1})
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is less lines than an if statement, but I'd argue harder to quickly read

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about something like this?

if self.CP.openpilotLongitudinalControl:
  ret.buttonEvents = create_button_events(self.cruise_buttons[-1], prev_cruise_buttons, BUTTONS_DICT)

ret.buttonEvents = [
  *ret.buttonEvents,
  *create_button_events(self.lfa_button, prev_lfa_button, {1: ButtonType.altButton1})
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
car related to opendbc/car/ DBC signals hyundai
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants