sunnypilot v2026.002.000
version: sunnypilot v2026.002.000 (staging) date: 2026-07-21T07:44:02 master commit: 2c334ede443d7391d27575af8c854a095ba702a8
This commit is contained in:
commit
de77c89cf6
3995 files changed
+1260688
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,55 @@
|
||||
"""
|
||||
Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors.
|
||||
|
||||
This file is part of sunnypilot and is licensed under the MIT License.
|
||||
See the LICENSE.md file in the root directory for more details.
|
||||
"""
|
||||
from enum import StrEnum
|
||||
|
||||
from opendbc.car import Bus, create_button_events, structs
|
||||
from opendbc.can.parser import CANParser
|
||||
from opendbc.car.common.conversions import Conversions as CV
|
||||
from opendbc.car.tesla.values import DBC, CANBUS
|
||||
from opendbc.sunnypilot.car.tesla.values import TeslaFlagsSP
|
||||
|
||||
ButtonType = structs.CarState.ButtonEvent.Type
|
||||
|
||||
|
||||
class CarStateExt:
|
||||
def __init__(self, CP: structs.CarParams, CP_SP: structs.CarParamsSP):
|
||||
self.CP = CP
|
||||
self.CP_SP = CP_SP
|
||||
|
||||
self.infotainment_3_finger_press = 0
|
||||
|
||||
def update(self, ret: structs.CarState, ret_sp: structs.CarStateSP, can_parsers: dict[StrEnum, CANParser]) -> None:
|
||||
if self.CP_SP.flags & TeslaFlagsSP.HAS_VEHICLE_BUS:
|
||||
cp_adas = can_parsers[Bus.adas]
|
||||
|
||||
prev_infotainment_3_finger_press = self.infotainment_3_finger_press
|
||||
self.infotainment_3_finger_press = int(cp_adas.vl["UI_status2"]["UI_activeTouchPoints"])
|
||||
|
||||
ret.buttonEvents = [*create_button_events(self.infotainment_3_finger_press, prev_infotainment_3_finger_press,
|
||||
{3: ButtonType.lkas})]
|
||||
|
||||
cp_party = can_parsers[Bus.party]
|
||||
cp_ap_party = can_parsers[Bus.ap_party]
|
||||
|
||||
speed_units = self.can_define.dv["DI_state"]["DI_speedUnits"].get(int(cp_party.vl["DI_state"]["DI_speedUnits"]), None)
|
||||
speed_limit = cp_ap_party.vl["DAS_status"]["DAS_fusedSpeedLimit"]
|
||||
if self.can_define.dv["DAS_status"]["DAS_fusedSpeedLimit"].get(int(speed_limit), None) in ["NONE", "UNKNOWN_SNA"]:
|
||||
ret_sp.speedLimit = 0
|
||||
else:
|
||||
if speed_units == "KPH":
|
||||
ret_sp.speedLimit = speed_limit * CV.KPH_TO_MS
|
||||
elif speed_units == "MPH":
|
||||
ret_sp.speedLimit = speed_limit * CV.MPH_TO_MS
|
||||
|
||||
@staticmethod
|
||||
def get_parser(CP: structs.CarParams, CP_SP: structs.CarParamsSP) -> dict[StrEnum, CANParser]:
|
||||
messages = {}
|
||||
|
||||
if CP_SP.flags & TeslaFlagsSP.HAS_VEHICLE_BUS:
|
||||
messages[Bus.adas] = CANParser(DBC[CP.carFingerprint][Bus.adas], [], CANBUS.vehicle)
|
||||
|
||||
return messages
|
||||
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors.
|
||||
|
||||
This file is part of sunnypilot and is licensed under the MIT License.
|
||||
See the LICENSE.md file in the root directory for more details.
|
||||
"""
|
||||
from collections import namedtuple
|
||||
|
||||
from opendbc.car import structs
|
||||
from opendbc.sunnypilot.car.tesla.values import TeslaFlagsSP
|
||||
|
||||
CoopSteeringDataSP = namedtuple("CoopSteeringDataSP",
|
||||
["control_type"])
|
||||
|
||||
|
||||
class CoopSteeringCarController:
|
||||
def __init__(self):
|
||||
self.coop_steering = CoopSteeringDataSP(False)
|
||||
|
||||
@staticmethod
|
||||
def coop_steering_status_update(CP_SP: structs.CarParamsSP) -> CoopSteeringDataSP:
|
||||
coop_steering = CP_SP.flags & TeslaFlagsSP.COOP_STEERING.value
|
||||
control_type = 2 if coop_steering else 1
|
||||
|
||||
return CoopSteeringDataSP(control_type)
|
||||
|
||||
def update(self, CP_SP: structs.CarParamsSP) -> None:
|
||||
self.coop_steering = self.coop_steering_status_update(CP_SP)
|
||||
@@ -0,0 +1,12 @@
|
||||
from opendbc.car.structs import CarParams
|
||||
from opendbc.car.tesla.values import CAR
|
||||
|
||||
Ecu = CarParams.Ecu
|
||||
|
||||
FW_VERSIONS_EXT = {
|
||||
CAR.TESLA_MODEL_3: {
|
||||
(Ecu.eps, 0x730, None): [
|
||||
b'TeMYG4_Main_0.0.0 (67),E4HP015.02.1',
|
||||
],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors.
|
||||
|
||||
This file is part of sunnypilot and is licensed under the MIT License.
|
||||
See the LICENSE.md file in the root directory for more details.
|
||||
"""
|
||||
from enum import IntFlag
|
||||
|
||||
|
||||
class TeslaFlagsSP(IntFlag):
|
||||
HAS_VEHICLE_BUS = 1 # 3-finger infotainment press signal is present on the VEHICLE bus with the deprecated Tesla harness installed
|
||||
COOP_STEERING = 2 # Coop steering
|
||||
|
||||
|
||||
class TeslaSafetyFlagsSP:
|
||||
HAS_VEHICLE_BUS = 1
|
||||
Reference in new issue
Block a user