Merge branch 'brand/toyota/sdsu' into pre-toyota

This commit is contained in:
Rick Lan
2025-06-17 20:46:04 +08:00
3 changed files with 25 additions and 3 deletions

View File

@@ -153,7 +153,8 @@ class CarState(CarStateBase):
ret.cruiseState.speedCluster = cluster_set_speed * conversion_factor
if self.CP.carFingerprint in TSS2_CAR and not self.CP.flags & ToyotaFlags.DISABLE_RADAR.value:
self.acc_type = cp_acc.vl["ACC_CONTROL"]["ACC_TYPE"]
if not (self.CP.flags & ToyotaFlags.SDSU.value):
self.acc_type = cp_acc.vl["ACC_CONTROL"]["ACC_TYPE"]
ret.stockFcw = bool(cp_acc.vl["PCS_HUD"]["FCW"])
# some TSS2 cars have low speed lockout permanently set, so ignore on those cars
@@ -238,8 +239,12 @@ class CarState(CarStateBase):
if CP.carFingerprint in RADAR_ACC_CAR and not CP.flags & ToyotaFlags.DISABLE_RADAR.value:
pt_messages += [
("PCS_HUD", 1),
("ACC_CONTROL", 33),
# ("ACC_CONTROL", 33),
]
if not CP.flags & ToyotaFlags.SDSU.value:
pt_messages += [
("ACC_CONTROL", 33),
]
if CP.carFingerprint not in (TSS2_CAR - RADAR_ACC_CAR) and not CP.enableDsu and not CP.flags & ToyotaFlags.DISABLE_RADAR.value:
pt_messages += [

View File

@@ -128,6 +128,20 @@ class CarInterface(CarInterfaceBase):
ret.alphaLongitudinalAvailable = False
ret.flags |= ToyotaFlags.RADAR_FILTER.value | ToyotaFlags.DISABLE_RADAR.value
sdsu_active = False
if not (candidate in (RADAR_ACC_CAR | NO_DSU_CAR)) and 0x2FF in fingerprint[0]:
print("----------------------------------------------")
print("dragonpilot: SDSU detected!")
print("----------------------------------------------")
ret.safetyConfigs[0].safetyParam |= ToyotaSafetyFlags.LONG_FILTER.value
ret.enableDsu = False
sdsu_active = True
stop_and_go = True
ret.flags |= ToyotaFlags.SDSU.value
ret.alphaLongitudinalAvailable = False
# openpilot longitudinal enabled by default:
# - cars w/ DSU disconnected
# - TSS2 cars with camera sending ACC_CONTROL where we can block it
@@ -139,7 +153,8 @@ class CarInterface(CarInterfaceBase):
else:
ret.openpilotLongitudinalControl = ret.enableDsu or \
candidate in (TSS2_CAR - RADAR_ACC_CAR) or \
bool(ret.flags & ToyotaFlags.DISABLE_RADAR.value)
bool(ret.flags & ToyotaFlags.DISABLE_RADAR.value) or \
sdsu_active
ret.autoResumeSng = ret.openpilotLongitudinalControl and candidate in NO_STOP_TIMER_CAR

View File

@@ -61,6 +61,8 @@ class ToyotaSafetyFlags(IntFlag):
class ToyotaFlags(IntFlag):
# Detected flags
HYBRID = 1
# use legacy id
SDSU = 2
DISABLE_RADAR = 4
# Static flags