Gap Adjust Cruise: Fix unnecessary I/O (#287)

This commit is contained in:
Jason Wen
2023-09-23 13:53:46 -04:00
committed by GitHub
parent 231f2331aa
commit acdfbbb359
2 changed files with 6 additions and 3 deletions
+3 -2
View File
@@ -472,9 +472,10 @@ class CarInterfaceBase(ABC):
def toggle_gac(self, cs_out, CS, gac_button, gac_min, gac_max, gac_default, inc_dec):
if not self.CP.openpilotLongitudinalControl:
CS.gac_tr = 2
CS.gac_tr_cluster = gac_default
put_nonblocking("LongitudinalPersonality", "2")
if CS.gac_tr != 2:
CS.gac_tr = 2
put_nonblocking("LongitudinalPersonality", "2")
return cs_out, CS
if gac_button:
self.gac_button_counter += 1
+3 -1
View File
@@ -324,7 +324,9 @@ class CarInterface(CarInterfaceBase):
self.CS.madsEnabled = self.get_acc_mads(ret.cruiseState.enabled, self.CS.accEnabled, self.CS.madsEnabled)
if not self.CP.openpilotLongitudinalControl:
self.CS.gac_tr_cluster = 3
put_nonblocking("LongitudinalPersonality", "2")
if CS.gac_tr != 2:
CS.gac_tr = 2
put_nonblocking("LongitudinalPersonality", "2")
else:
gap_dist_button = bool(self.CS.gap_dist_button)
if gap_dist_button: