Toyota: Improve comma pedal Stop-and-Go

Co-Authored-By: Irene <12470297+cydia2020@users.noreply.github.com>
This commit is contained in:
FrogAi
2024-02-27 16:34:47 -07:00
parent 075e81ce44
commit 6fe645e21c
4 changed files with 23 additions and 19 deletions

View File

@@ -175,6 +175,12 @@ class CarState(CarStateBase):
if self.CP.carFingerprint != CAR.PRIUS_V:
self.lkas_hud = copy.copy(cp_cam.vl["LKAS_HUD"])
# if openpilot does not control longitudinal, in this case, assume 0x343 is on bus0
# 1) the car is no longer sending standstill
# 2) the car is still in standstill
if not self.CP.openpilotLongitudinalControl:
self.stock_resume_ready = cp.vl["ACC_CONTROL"]["RELEASE_STANDSTILL"] == 1
# FrogPilot functions
if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR) or (self.CP.flags & ToyotaFlags.SMART_DSU and not self.CP.flags & ToyotaFlags.RADAR_CAN_FILTER):
# distance button is wired to the ACC module (camera or radar)
@@ -303,7 +309,7 @@ class CarState(CarStateBase):
if CP.enableBsm:
messages.append(("BSM", 1))
if CP.carFingerprint in RADAR_ACC_CAR and not CP.flags & ToyotaFlags.DISABLE_RADAR.value:
if not CP.openpilotLongitudinalControl or (CP.carFingerprint in RADAR_ACC_CAR and not CP.flags & ToyotaFlags.DISABLE_RADAR.value):
if not CP.flags & ToyotaFlags.SMART_DSU.value:
messages += [
("ACC_CONTROL", 33),
@@ -345,4 +351,7 @@ class CarState(CarStateBase):
("PCS_HUD", 1),
]
if not CP.openpilotLongitudinalControl and CP.carFingerprint not in (TSS2_CAR, UNSUPPORTED_DSU_CAR):
messages.append(("ACC_CONTROL", 33))
return CANParser(DBC[CP.carFingerprint]["pt"], messages, 2)