mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 08:16:06 +08:00
test2
This commit is contained in:
@@ -11,7 +11,6 @@ from opendbc.car.structs import CarParams, CarParamsT
|
||||
from opendbc.car.fingerprints import eliminate_incompatible_cars, all_legacy_fingerprint_cars
|
||||
from opendbc.car.fw_versions import ObdCallback, get_fw_versions_ordered, get_present_ecus, match_fw_to_car
|
||||
from opendbc.car.mock.values import CAR as MOCK
|
||||
from opendbc.car.toyota.values import ToyotaStarPilotFlags
|
||||
from opendbc.car.values import BRANDS
|
||||
from opendbc.car.vin import get_vin, is_valid_vin, VIN_UNKNOWN
|
||||
from openpilot.common.params import Params
|
||||
@@ -301,10 +300,6 @@ def get_car(can_recv: CanRecvCallable, can_send: CanSendCallable, set_obd_multip
|
||||
|
||||
FPCP: StarPilotCarParams = CarInterface.get_starpilot_params(candidate, fingerprints, car_fw, CP, starpilot_toggles)
|
||||
|
||||
if CP.brand == "toyota" and FPCP.flags & ToyotaStarPilotFlags.SMART_DSU.value:
|
||||
CP.minEnableSpeed = -1
|
||||
CP.openpilotLongitudinalControl = True
|
||||
|
||||
if not CP.alphaLongitudinalAvailable and starpilot_toggles.disable_openpilot_long:
|
||||
CP.openpilotLongitudinalControl = False
|
||||
FPCP.openpilotLongitudinalControlDisabled = True
|
||||
|
||||
@@ -171,7 +171,10 @@ 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"]
|
||||
# smartDSU can intercept ACC_CONTROL, so don't require it when it's no
|
||||
# longer forwarded on the PT bus.
|
||||
if not self.has_SDSU:
|
||||
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
|
||||
|
||||
@@ -50,6 +50,11 @@ class CarInterface(CarInterfaceBase):
|
||||
|
||||
stop_and_go = candidate in TSS2_CAR
|
||||
|
||||
# Detect smartDSU, which intercepts ACC_CMD from the DSU (or radar) allowing
|
||||
# openpilot to send it. 0x2AA is sent by a similar device which intercepts
|
||||
# the radar instead of DSU on NO_DSU_CARs.
|
||||
use_sdsu = bool(0x2FF in fingerprint[0] or (0x2AA in fingerprint[0] and candidate in NO_DSU_CAR))
|
||||
|
||||
# In TSS2 cars, the camera does long control
|
||||
found_ecus = [fw.ecu for fw in car_fw]
|
||||
|
||||
@@ -104,21 +109,27 @@ class CarInterface(CarInterfaceBase):
|
||||
# TODO: make an adas dbc file for dsu-less models
|
||||
ret.radarUnavailable = Bus.radar not in DBC[candidate] or candidate in (NO_DSU_CAR - TSS2_CAR)
|
||||
|
||||
# since we don't yet parse radar on TSS2/TSS-P radar-based ACC cars, gate longitudinal behind experimental toggle
|
||||
# Since we don't yet parse radar on TSS2/TSS-P radar-based ACC cars, gate
|
||||
# longitudinal behind the alpha-long toggle.
|
||||
if candidate in (RADAR_ACC_CAR | NO_DSU_CAR):
|
||||
ret.alphaLongitudinalAvailable = candidate in RADAR_ACC_CAR
|
||||
ret.alphaLongitudinalAvailable = use_sdsu or candidate in RADAR_ACC_CAR
|
||||
|
||||
# Disabling radar is only supported on TSS2 radar-ACC cars
|
||||
if alpha_long and candidate in RADAR_ACC_CAR:
|
||||
ret.flags |= ToyotaFlags.DISABLE_RADAR.value
|
||||
if not use_sdsu:
|
||||
# Disabling radar is only supported on TSS2 radar-ACC cars.
|
||||
if alpha_long and candidate in RADAR_ACC_CAR:
|
||||
ret.flags |= ToyotaFlags.DISABLE_RADAR.value
|
||||
else:
|
||||
use_sdsu = use_sdsu and alpha_long
|
||||
|
||||
# openpilot longitudinal enabled by default:
|
||||
# - cars w/ DSU disconnected
|
||||
# - non-(TSS2 radar ACC cars) w/ smartDSU or radar filter installed
|
||||
# - TSS2 cars with camera sending ACC_CONTROL where we can block it
|
||||
# openpilot longitudinal behind experimental long toggle:
|
||||
# - TSS2 radar ACC cars w/ smartDSU or radar filter installed
|
||||
# - TSS2 radar ACC cars (disables radar)
|
||||
|
||||
ret.openpilotLongitudinalControl = (candidate in (TSS2_CAR - RADAR_ACC_CAR) or
|
||||
ret.openpilotLongitudinalControl = (use_sdsu or
|
||||
candidate in (TSS2_CAR - RADAR_ACC_CAR) or
|
||||
bool(ret.flags & ToyotaFlags.DISABLE_RADAR.value))
|
||||
|
||||
ret.autoResumeSng = ret.openpilotLongitudinalControl and candidate in NO_STOP_TIMER_CAR
|
||||
|
||||
@@ -141,7 +141,8 @@ class UIState:
|
||||
elif not self.sm.alive["wideRoadCameraState"] or not self.sm.valid["wideRoadCameraState"]:
|
||||
self.light_sensor = -1
|
||||
|
||||
started = self.sm["deviceState"].started and self.ignition
|
||||
# Trust hardwared's filtered started state; raw ignition can flap on Toyota.
|
||||
started = self.sm["deviceState"].started
|
||||
started |= self.params.get_bool("ForceOnroad")
|
||||
started &= not self.params.get_bool("ForceOffroad")
|
||||
self.started = started
|
||||
|
||||
Reference in New Issue
Block a user