Gap Adjust Cruise: Remove unused variables (#264)

This commit is contained in:
Jason Wen
2023-09-14 03:47:47 -04:00
committed by GitHub
parent b868339f7a
commit b2ef8fb5bf
6 changed files with 6 additions and 25 deletions
-2
View File
@@ -247,8 +247,6 @@ std::unordered_map<std::string, uint32_t> keys = {
{"EnforceTorqueLateral", PERSISTENT},
{"EnhancedScc", PERSISTENT},
{"FleetManagerPin", PERSISTENT},
{"GapAdjustCruiseMax", PERSISTENT},
{"GapAdjustCruiseMin", PERSISTENT},
{"GmapKey", PERSISTENT},
{"GpxDeleteAfterUpload", PERSISTENT},
{"GpxDeleteIfUploaded", PERSISTENT},
-8
View File
@@ -108,8 +108,6 @@ class CarInterfaceBase(ABC):
self.op_lookup = {"+": operator.add, "-": operator.sub}
self.prev_gac_button = False
self.gac_button_counter = 0
self.gac_min = -1
self.gac_max = -1
self.reverse_dm_cam = self.param_s.get_bool("ReverseDmCam")
self.mads_main_toggle = self.param_s.get_bool("MadsCruiseMain")
self.lkas_toggle = self.param_s.get_bool("LkasToggle")
@@ -481,12 +479,6 @@ class CarInterfaceBase(ABC):
CS.gac_tr = gac_default
put_nonblocking("LongitudinalPersonality", self.get_sp_gac_mpc(3))
return cs_out, CS
if self.gac_min != gac_min:
self.gac_min = gac_min
put_nonblocking("GapAdjustCruiseMin", str(self.gac_min))
if self.gac_max != gac_max:
self.gac_max = gac_max
put_nonblocking("GapAdjustCruiseMax", str(self.gac_max))
if gac_button:
self.gac_button_counter += 1
elif self.prev_gac_button and not gac_button and self.gac_button_counter < 50:
+5 -10
View File
@@ -15,7 +15,8 @@ SteerControlType = car.CarParams.SteerControlType
GearShifter = car.CarState.GearShifter
GAC_DICT = {3: 1, 2: 2, 1: 3}
GAC_MIN = 1
GAC_MAX = 3
class CarInterface(CarInterfaceBase):
@staticmethod
@@ -317,19 +318,13 @@ class CarInterface(CarInterfaceBase):
cluster_gap_display = 3
put_nonblocking("LongitudinalPersonality", self.get_sp_gac_mpc(3))
else:
if self.gac_min != 1:
self.gac_min = 1
put_nonblocking("GapAdjustCruiseMin", str(self.gac_min))
if self.gac_max != 3:
self.gac_max = 3
put_nonblocking("GapAdjustCruiseMax", str(self.gac_max))
gap_dist_button = bool(self.CS.gap_dist_button)
if gap_dist_button:
self.gac_button_counter += 1
elif self.prev_gac_button and not gap_dist_button and self.gac_button_counter < 50:
self.gac_button_counter = 0
follow_distance_converted = self.get_sp_gac_state(self.CS.follow_distance, self.gac_min, self.gac_max, "+")
gac_tr = self.get_sp_distance(follow_distance_converted, self.gac_max, gac_dict=GAC_DICT)
follow_distance_converted = self.get_sp_gac_state(self.CS.follow_distance, GAC_MIN, GAC_MAX, "+")
gac_tr = self.get_sp_distance(follow_distance_converted, GAC_MAX, gac_dict=GAC_DICT)
if gac_tr != self.CS.gac_tr:
put_nonblocking("LongitudinalPersonality", self.get_sp_gac_mpc(gac_tr))
self.CS.gac_tr = gac_tr
@@ -337,7 +332,7 @@ class CarInterface(CarInterfaceBase):
self.gac_button_counter = 0
self.prev_gac_button = gap_dist_button
cluster_gap_display = self.CS.gac_tr
gap_distance = self.get_sp_distance(cluster_gap_display, self.gac_max, gac_dict=GAC_DICT)
gap_distance = self.get_sp_distance(cluster_gap_display, GAC_MAX, gac_dict=GAC_DICT)
if self.CS.gac_send_counter < 10 and gap_distance != self.CS.follow_distance:
self.CS.gac_send_counter += 1
self.CS.gac_send = 1
-2
View File
@@ -73,8 +73,6 @@ def manager_init() -> None:
("DynamicLaneProfileToggle", "0"),
("EnableMads", "1"),
("EnhancedScc", "0"),
("GapAdjustCruiseMax", "0"),
("GapAdjustCruiseMin", "0"),
("GpxDeleteAfterUpload", "1"),
("GpxDeleteIfUploaded", "1"),
("HandsOnWheelMonitoring", "0"),
-2
View File
@@ -246,8 +246,6 @@ void ui_update_params(UIState *s) {
s->scene.hide_vego_ui = params.getBool("HideVEgoUi");
s->scene.true_vego_ui = params.getBool("TrueVEgoUi");
s->scene.chevron_data = std::atoi(params.get("ChevronInfo").c_str());
s->scene.gac_min = std::atoi(params.get("GapAdjustCruiseMin").c_str());
s->scene.gac_max = std::atoi(params.get("GapAdjustCruiseMax").c_str());
s->scene.dev_ui_enabled = params.getBool("DevUI");
s->scene.dev_ui_info = std::atoi(params.get("DevUIInfo").c_str());
s->scene.button_auto_hide = params.getBool("ButtonAutoHide");
+1 -1
View File
@@ -197,7 +197,7 @@ typedef struct UIScene {
int chevron_data;
bool gac;
int longitudinal_personality, gac_min, gac_max;
int longitudinal_personality;
bool map_visible;
bool dev_ui_enabled;