From 86d29e15b1d332094580311b553355403bf0e29f Mon Sep 17 00:00:00 2001 From: tb205gti Date: Thu, 7 Nov 2019 13:14:38 +0100 Subject: [PATCH] Prevent multiple readings of the pid params file (#119) ..only load the pid values when we initiate the LoC --- selfdrive/car/tesla/PCC_module.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/selfdrive/car/tesla/PCC_module.py b/selfdrive/car/tesla/PCC_module.py index 2a0e52210..a3423cb3d 100644 --- a/selfdrive/car/tesla/PCC_module.py +++ b/selfdrive/car/tesla/PCC_module.py @@ -229,6 +229,10 @@ def reset(self, v_pid): def update_stat(self, CS, enabled): if not self.LoC: self.LoC = LongControl(CS.CP, tesla_compute_gb) + # Get v_id from the stored file when initiating the LoC and reset_on_disengage==false + if (not RESET_PID_ON_DISENGAGE): + self.load_pid() + can_sends = [] if CS.pedal_interceptor_available and not CS.cstm_btns.get_button_status("pedal"): @@ -406,11 +410,7 @@ def update_pdl(self, enabled, CS, frame, actuators, pcm_speed, speed_limit_ms, s # how much accel and break we have to do #################################################################### if PCCModes.is_selected(FollowMode(), CS.cstm_btns): - # Get v_id from the stored file, only the first activation where v_pid eq 0 - if (not RESET_PID_ON_DISENGAGE and self.v_pid == 0.): - self.load_pid() - else: - self.v_pid = self.calc_follow_speed_ms(CS,alca_enabled) + self.v_pid = self.calc_follow_speed_ms(CS,alca_enabled) if mapd is not None: v_curve = max_v_in_mapped_curve_ms(mapd.liveMapData, self.pedal_speed_kph)