Skip to content

Commit

Permalink
Ford: Parse Lane Centering button from steering wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyhaibin committed Sep 24, 2024
1 parent 8c17e03 commit 26d4bac
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion opendbc/car/ford/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __init__(self, CP):
self.shifter_values = can_define.dv["PowertrainData_10"]["TrnRng_D_Rq"]

self.distance_button = 0
self.lc_button = 0

def update(self, cp, cp_cam, *_) -> structs.CarState:
ret = structs.CarState()
Expand Down Expand Up @@ -86,7 +87,9 @@ def update(self, cp, cp_cam, *_) -> structs.CarState:
# TODO: block this going to the camera otherwise it will enable stock TJA
ret.genericToggle = bool(cp.vl["Steering_Data_FD1"]["TjaButtnOnOffPress"])
prev_distance_button = self.distance_button
prev_lc_button = self.lc_button
self.distance_button = cp.vl["Steering_Data_FD1"]["AccButtnGapTogglePress"]
self.lc_button = bool(cp.vl["Steering_Data_FD1"]["TjaButtnOnOffPress"])

# lock info
ret.doorOpen = any([cp.vl["BodyInfo_3_FD1"]["DrStatDrv_B_Actl"], cp.vl["BodyInfo_3_FD1"]["DrStatPsngr_B_Actl"],
Expand All @@ -105,7 +108,10 @@ def update(self, cp, cp_cam, *_) -> structs.CarState:
self.acc_tja_status_stock_values = cp_cam.vl["ACCDATA_3"]
self.lkas_status_stock_values = cp_cam.vl["IPMA_Data"]

ret.buttonEvents = create_button_events(self.distance_button, prev_distance_button, {1: ButtonType.gapAdjustCruise})
ret.buttonEvents = [
*create_button_events(self.distance_button, prev_distance_button, {1: ButtonType.gapAdjustCruise}),
*create_button_events(self.lc_button, prev_lc_button, {1: ButtonType.altButton1}),
]

return ret

Expand Down

0 comments on commit 26d4bac

Please sign in to comment.