FrogPilot features - Personalities only change if the GM menu is open

This commit is contained in:
FrogAi 2024-05-27 10:00:39 -07:00
parent 7e71422936
commit 94f25c0b72
2 changed files with 12 additions and 2 deletions

View File

@ -169,6 +169,9 @@ class CarState(CarStateBase):
ret.leftBlindspot = cam_cp.vl["BCMBlindSpotMonitor"]["LeftBSM"] == 1
ret.rightBlindspot = cam_cp.vl["BCMBlindSpotMonitor"]["RightBSM"] == 1
# FrogPilot carstate functions
fp_ret.hasCamera = not (self.CP.flags & GMFlags.NO_CAMERA.value) and self.CP.carFingerprint not in CC_ONLY_CAR
return ret, fp_ret
@staticmethod

View File

@ -72,6 +72,8 @@ class Controls:
self.openpilot_crashed_triggered = False
self.display_timer = 0
self.card = CarD(CI)
self.params = Params()
@ -672,8 +674,13 @@ class Controls:
# decrement personality on distance button press
if self.CP.openpilotLongitudinalControl:
if any(not be.pressed and be.type == ButtonType.gapAdjustCruise for be in CS.buttonEvents):
self.personality = (self.personality - 1) % 3
self.params.put_nonblocking('LongitudinalPersonality', str(self.personality))
menu_open = self.display_timer > 0 or self.CP.carName != "gm" or not self.sm['frogpilotCarState'].hasCamera
if menu_open:
self.personality = (self.personality - 1) % 3
self.params.put_nonblocking('LongitudinalPersonality', str(self.personality))
self.display_timer = 350
self.display_timer -= 1
return CC, lac_log