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

GM: Parse LKAS button from steering wheel #1276

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion opendbc/car/gm/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@ def __init__(self, CP):
self.buttons_counter = 0

self.distance_button = 0
self.lkas_button = 0

def update(self, pt_cp, cam_cp, _, __, loopback_cp) -> structs.CarState:
ret = structs.CarState()

prev_cruise_buttons = self.cruise_buttons
prev_distance_button = self.distance_button
prev_lkas_button = self.lkas_button
self.cruise_buttons = pt_cp.vl["ASCMSteeringButton"]["ACCButtons"]
self.distance_button = pt_cp.vl["ASCMSteeringButton"]["DistanceButton"]
self.lkas_button = pt_cp.vl["ASCMSteeringButton"]["LKAButton"]
self.buttons_counter = pt_cp.vl["ASCMSteeringButton"]["RollingCounter"]
self.pscm_status = copy.copy(pt_cp.vl["PSCMStatus"])
# This is to avoid a fault where you engage while still moving backwards after shifting to D.
Expand Down Expand Up @@ -135,7 +138,9 @@ def update(self, pt_cp, cam_cp, _, __, loopback_cp) -> structs.CarState:
*create_button_events(self.cruise_buttons, prev_cruise_buttons, BUTTONS_DICT,
unpressed_btn=CruiseButtons.UNPRESS),
*create_button_events(self.distance_button, prev_distance_button,
{1: ButtonType.gapAdjustCruise})
{1: ButtonType.gapAdjustCruise}),
*create_button_events(self.lkas_button, prev_lkas_button,
{1: ButtonType.altButton1})
]

return ret
Expand Down
Loading