Skip to content

Commit

Permalink
Fix for cars having higher / lower set speeds
Browse files Browse the repository at this point in the history
this is to avoid a crash in the code
  • Loading branch information
arne182 authored Sep 7, 2020
1 parent d7b7d0d commit 5ce6ce6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion selfdrive/car/toyota/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ def update(self, cp, cp_cam, frame):
else:
self.low_speed_lockout = cp.vl["PCM_CRUISE_2"]['LOW_SPEED_LOCKOUT'] == 2
ret.cruiseState.available = self.main_on
v_cruise_pcm_max = ret.cruiseState.speed
if self.CP.carFingerprint in TSS2_CAR:
minimum_set_speed = 27.0
elif self.CP.carFingerprint == CAR.RAV4:
Expand All @@ -212,6 +211,11 @@ def update(self, cp, cp_cam, frame):
maximum_set_speed = 169.0
if self.CP.carFingerprint == CAR.LEXUS_RXH:
maximum_set_speed = 177.0
v_cruise_pcm_max = ret.cruiseState.speed
if v_cruise_pcm_max < minimum_set_speed:
minimum_set_speed = v_cruise_pcm_max
if v_cruise_pcm_max > maximum_set_speed:
maximum_set_speed = v_cruise_pcm_max
speed_range = maximum_set_speed-minimum_set_speed
if bool(cp.vl["PCM_CRUISE"]['CRUISE_ACTIVE']) and not self.pcm_acc_active and self.v_cruise_pcmlast != ret.cruiseState.speed:
if ret.vEgo < 12.5:
Expand Down

0 comments on commit 5ce6ce6

Please sign in to comment.