Only change driving personality if the menu is open (GM only)
This commit is contained in:
@@ -10,6 +10,8 @@ from cereal import car, custom, log
|
||||
from msgq.visionipc import VisionIpcClient, VisionStreamType
|
||||
|
||||
|
||||
from opendbc.car.gm.values import CC_ONLY_CAR
|
||||
|
||||
from openpilot.common.params import Params
|
||||
from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper, DT_CTRL
|
||||
from openpilot.common.swaglog import cloudlog
|
||||
@@ -157,8 +159,12 @@ class SelfdriveD:
|
||||
|
||||
self.distance_pressed_previously = False
|
||||
|
||||
self.display_timer = 0
|
||||
|
||||
self.frogpilot_events_prev = []
|
||||
|
||||
self.has_menu = self.CP.brand == "gm" and self.CP.carFingerprint not in CC_ONLY_CAR
|
||||
|
||||
self.FPCP = messaging.log_from_bytes(self.params.get("FrogPilotCarParams", block=True), custom.FrogPilotCarParams)
|
||||
|
||||
if self.frogpilot_toggles.block_user:
|
||||
@@ -447,12 +453,16 @@ class SelfdriveD:
|
||||
distance_pressed |= any(not be.pressed and be.type == ButtonType.lkas for be in CS.buttonEvents)
|
||||
|
||||
if not distance_pressed and self.distance_pressed_previously:
|
||||
self.personality = (self.personality - 1) % 3
|
||||
self.params.put_nonblocking('LongitudinalPersonality', self.personality)
|
||||
self.events.add(EventName.personalityChanged)
|
||||
if self.display_timer > 0 or not self.has_menu:
|
||||
self.personality = (self.personality - 1) % 3
|
||||
self.params.put_nonblocking('LongitudinalPersonality', self.personality)
|
||||
self.events.add(EventName.personalityChanged)
|
||||
self.display_timer = 350
|
||||
|
||||
self.distance_pressed_previously = distance_pressed
|
||||
|
||||
self.display_timer -= 1
|
||||
|
||||
# FrogPilot variables
|
||||
self.frogpilot_events.add_from_msg(self.sm['frogpilotPlan'].frogpilotEvents)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user