Skip to content

Commit ffbe609

Browse files
authored
Tesla: detect missing DAS_settings (commaai#3082)
* detect das_settings * clean up * rm * clean up
1 parent 0702326 commit ffbe609

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

opendbc/car/tesla/carstate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from opendbc.car.common.conversions import Conversions as CV
66
from opendbc.car.interfaces import CarStateBase
77
from opendbc.car.tesla.teslacan import get_steer_ctrl_type
8-
from opendbc.car.tesla.values import DBC, CANBUS, GEAR_MAP, STEER_THRESHOLD, CAR, TeslaFlags
8+
from opendbc.car.tesla.values import DBC, CANBUS, GEAR_MAP, STEER_THRESHOLD, TeslaFlags
99

1010
ButtonType = structs.CarState.ButtonEvent.Type
1111

@@ -116,8 +116,8 @@ def update(self, can_parsers) -> structs.CarState:
116116
ret.stockLkas = cp_ap_party.vl["DAS_steeringControl"]["DAS_steeringControlType"] == lkas_ctrl_type # LANE_KEEP_ASSIST
117117

118118
# Stock Autosteer should be off (includes FSD)
119-
# TODO: find for TESLA_MODEL_X
120-
if self.CP.carFingerprint in (CAR.TESLA_MODEL_3, CAR.TESLA_MODEL_Y):
119+
# TODO: find for TESLA_MODEL_X and HW2.5 vehicles
120+
if not (self.CP.flags & TeslaFlags.MISSING_DAS_SETTINGS):
121121
ret.invalidLkasSetting = cp_ap_party.vl["DAS_settings"]["DAS_autosteerEnabled"] != 0
122122

123123
# Because we don't have FSD 14 detection outside of a set of FW, we should check if this FW is accidentally missing from FSD_14_FW

opendbc/car/tesla/interface.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from opendbc.car.interfaces import CarInterfaceBase
33
from opendbc.car.tesla.carcontroller import CarController
44
from opendbc.car.tesla.carstate import CarState
5-
from opendbc.car.tesla.values import TeslaSafetyFlags, TeslaFlags, CAR, DBC, FSD_14_FW, Ecu
5+
from opendbc.car.tesla.values import TeslaSafetyFlags, TeslaFlags, CANBUS, CAR, DBC, FSD_14_FW, Ecu
66
from opendbc.car.tesla.radar_interface import RadarInterface, RADAR_START_ADDR
77

88

@@ -23,6 +23,10 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, alpha_lo
2323

2424
ret.steerControlType = structs.CarParams.SteerControlType.angle
2525

26+
# Model X and HW 2.5 vehicles are missing DAS_settings
27+
if 0x293 not in fingerprint[CANBUS.autopilot_party]:
28+
ret.flags |= TeslaFlags.MISSING_DAS_SETTINGS.value
29+
2630
# Radar support is intended to work for:
2731
# - Tesla Model 3 vehicles built approximately mid-2017 through early-2021
2832
# - Tesla Model Y vehicles built approximately mid-2020 through early-2021

opendbc/car/tesla/values.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ class TeslaSafetyFlags(IntFlag):
135135
class TeslaFlags(IntFlag):
136136
LONG_CONTROL = 1
137137
FSD_14 = 2
138+
MISSING_DAS_SETTINGS = 4
138139

139140

140141
DBC = CAR.create_dbc_map()

0 commit comments

Comments
 (0)