Skip to content

Commit

Permalink
GAC: check state properly (commaai#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyhaibin authored Jun 25, 2023
1 parent afb4462 commit 8eb936d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion selfdrive/car/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def get_sp_distance(self, gac_tr, gac_max, gac_dict=None):
return next((key for key, value in gac_dict.items() if value == gac_tr), gac_max)

def toggle_gac(self, cs_out, CS, gac_button, gac_min, gac_max, gac_default, inc_dec):
if not (self.CP.openpilotLongitudinalControl or self.gac):
if not self.CP.openpilotLongitudinalControl or not self.gac:
cs_out.gapAdjustCruiseTr = 4
CS.gac_tr = gac_default
return
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/toyota/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def _update(self, c):
(self.CS.prev_lkas_enabled == 1 and not self.CS.lkas_enabled):
self.CS.madsEnabled = not self.CS.madsEnabled
self.CS.madsEnabled = self.get_acc_mads(ret.cruiseState.enabled, self.CS.accEnabled, self.CS.madsEnabled)
if not (self.CP.openpilotLongitudinalControl or self.gac):
if not self.CP.openpilotLongitudinalControl or not self.gac:
ret.gapAdjustCruiseTr = 3
else:
if self.gac_min != 1:
Expand Down

0 comments on commit 8eb936d

Please # to comment.