Skip to content

Commit

Permalink
force standard CC if pedal present
Browse files Browse the repository at this point in the history
  • Loading branch information
BogGyver committed Nov 25, 2019
1 parent de34cbe commit 405bf34
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions selfdrive/car/tesla/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ def __init__(self, CP):
self.ahbHiBeamOn = 0
self.ahbNightMode = 0

def config_ui_buttons(self, pedalPresent):
if pedalPresent:
def config_ui_buttons(self, pedalAvailable, pedalPresent):
if pedalAvailable:
self.btns_init[1] = [PCCModes.BUTTON_NAME, PCCModes.BUTTON_ABREVIATION, PCCModes.labels()]
else:
# we don't have pedal interceptor
Expand All @@ -426,7 +426,9 @@ def config_ui_buttons(self, pedalPresent):
btn.btn_label = self.btns_init[1][1]
btn.btn_label2 = self.btns_init[1][2][0]
btn.btn_status = 1
self.cstm_btns.update_ui_buttons(1, 1)
if (not pedalAvailable) and pedalPresent:
btn.btn_label2 = self.btns_init[1][2][1]
self.cstm_btns.update_ui_buttons(1, 1)

def compute_speed(self):
# if one of them is zero, select max of the two
Expand Down Expand Up @@ -667,7 +669,7 @@ def update(self, cp, epas_cp, pedal_cp):
# Mark pedal unavailable while traditional cruise is on.
self.pedal_interceptor_available = pedal_interceptor_present and (self.forcePedalOverCC or not bool(self.pcm_acc_status))
if self.pedal_interceptor_available != self.prev_pedal_interceptor_available:
self.config_ui_buttons(self.pedal_interceptor_available)
self.config_ui_buttons(self.pedal_interceptor_available, pedal_interceptor_present)

self.v_cruise_actual = self.DI_cruiseSet
self.hud_lead = 0 #JCT
Expand Down

0 comments on commit 405bf34

Please sign in to comment.