Skip to content

Commit 773207d

Browse files
authored
Ford: Parse Lane Centering button from steering wheel (#1275)
* Ford: Parse Lane Centering button from steering wheel * fix name
1 parent a040333 commit 773207d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

opendbc/car/ford/carstate.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def __init__(self, CP):
1919
self.shifter_values = can_define.dv["PowertrainData_10"]["TrnRng_D_Rq"]
2020

2121
self.distance_button = 0
22+
self.lc_button = 0
2223

2324
def update(self, can_parsers) -> structs.CarState:
2425
cp = can_parsers[Bus.pt]
@@ -91,7 +92,9 @@ def update(self, can_parsers) -> structs.CarState:
9192
# TODO: block this going to the camera otherwise it will enable stock TJA
9293
ret.genericToggle = bool(cp.vl["Steering_Data_FD1"]["TjaButtnOnOffPress"])
9394
prev_distance_button = self.distance_button
95+
prev_lc_button = self.lc_button
9496
self.distance_button = cp.vl["Steering_Data_FD1"]["AccButtnGapTogglePress"]
97+
self.lc_button = bool(cp.vl["Steering_Data_FD1"]["TjaButtnOnOffPress"])
9598

9699
# lock info
97100
ret.doorOpen = any([cp.vl["BodyInfo_3_FD1"]["DrStatDrv_B_Actl"], cp.vl["BodyInfo_3_FD1"]["DrStatPsngr_B_Actl"],
@@ -110,7 +113,10 @@ def update(self, can_parsers) -> structs.CarState:
110113
self.acc_tja_status_stock_values = cp_cam.vl["ACCDATA_3"]
111114
self.lkas_status_stock_values = cp_cam.vl["IPMA_Data"]
112115

113-
ret.buttonEvents = create_button_events(self.distance_button, prev_distance_button, {1: ButtonType.gapAdjustCruise})
116+
ret.buttonEvents = [
117+
*create_button_events(self.distance_button, prev_distance_button, {1: ButtonType.gapAdjustCruise}),
118+
*create_button_events(self.lc_button, prev_lc_button, {1: ButtonType.lkas}),
119+
]
114120

115121
return ret
116122

0 commit comments

Comments
 (0)