sunnypilot v2026.002.000

version: sunnypilot v2026.002.000 (staging)
date: 2026-07-21T07:44:02
master commit: 2c334ede443d7391d27575af8c854a095ba702a8
This commit is contained in:
github-actions[bot] committed 2026-07-21 07:44:02 +00:00
commit de77c89cf6
3995 files changed
+1260688

No files matched your search

Whitespace-only changes.
@@ -0,0 +1,23 @@
from opendbc.car import structs
from opendbc.car.interfaces import CarStateBase
from opendbc.car.chrysler.values import RAM_DT
from opendbc.sunnypilot.car.chrysler.values_ext import ChryslerFlagsSP
GearShifter = structs.CarState.GearShifter
class CarControllerExt:
def __init__(self, CP: structs.CarParams, CP_SP: structs.CarParamsSP):
self.CP = CP
self.CP_SP = CP_SP
def get_lkas_control_bit(self, CS: CarStateBase, CC: structs.CarControl, lkas_control_bit: bool) -> bool:
if self.CP_SP.flags & ChryslerFlagsSP.NO_MIN_STEERING_SPEED:
lkas_control_bit = CC.latActive
elif self.CP.carFingerprint in RAM_DT:
if self.CP.minEnableSpeed <= CS.out.vEgo <= self.CP.minEnableSpeed + 0.5:
lkas_control_bit = True
if self.CP.minEnableSpeed >= 14.5 and CS.out.gearShifter != GearShifter.drive:
lkas_control_bit = False
return lkas_control_bit
@@ -0,0 +1,40 @@
"""
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, structs
from opendbc.can.parser import CANParser
from opendbc.car.chrysler.values import RAM_HD
from opendbc.sunnypilot.car.chrysler.values_ext import BUTTONS
class CarStateExt:
def __init__(self, CP, CP_SP):
self.CP = CP
self.CP_SP = CP_SP
self.button_events = []
self.button_states = {button.event_type: False for button in BUTTONS}
def update(self, ret: structs.CarState, ret_sp: structs.CarStateSP, can_parsers: dict[StrEnum, CANParser]):
cp = can_parsers[Bus.pt]
button_events = []
for button in BUTTONS:
state = (cp.vl[button.can_addr][button.can_msg] in button.values)
if self.button_states[button.event_type] != state:
event = structs.CarState.ButtonEvent.new_message()
event.type = button.event_type
event.pressed = state
button_events.append(event)
self.button_states[button.event_type] = state
self.button_events = button_events
if self.CP.carFingerprint in RAM_HD:
ret.steeringAngleDeg = cp.vl["STEERING"]["STEERING_ANGLE"]
@@ -0,0 +1,27 @@
from opendbc.car.structs import CarParams
from opendbc.car.chrysler.values import CAR
Ecu = CarParams.Ecu
FW_VERSIONS_EXT = {
CAR.RAM_1500_5TH_GEN: {
(Ecu.combinationMeter, 0x742, None): [
b'68453485AC',
b'68510283AH',
],
(Ecu.eps, 0x75a, None): [
b'68552791AA',
],
(Ecu.engine, 0x7e0, None): [
b'05149390AA ',
b'68378696AI ',
b'68500631AF',
],
(Ecu.transmission, 0x7e1, None): [
b'68360085AF',
b'68360086AL',
b'68502996AC',
],
},
}
@@ -0,0 +1,48 @@
"""
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 opendbc.car import structs
from opendbc.car.can_definitions import CanData
from opendbc.car.chrysler import chryslercan
from opendbc.car.chrysler.values import RAM_CARS
from opendbc.sunnypilot.car.intelligent_cruise_button_management_interface_base import IntelligentCruiseButtonManagementInterfaceBase
ButtonType = structs.CarState.ButtonEvent.Type
SendButtonState = structs.IntelligentCruiseButtonManagement.SendButtonState
class IntelligentCruiseButtonManagementInterface(IntelligentCruiseButtonManagementInterfaceBase):
def __init__(self, CP, CP_SP):
super().__init__(CP, CP_SP)
def update(self, CS, CC_SP, packer, frame, last_button_frame) -> list[CanData]:
can_sends = []
self.CC_SP = CC_SP
self.ICBM = CC_SP.intelligentCruiseButtonManagement
self.frame = frame
self.last_button_frame = last_button_frame
ram_cars = self.CP.carFingerprint in RAM_CARS
das_bus = 2 if self.CP.carFingerprint in RAM_CARS else 0
if self.ICBM.sendButton != SendButtonState.none:
accel = self.ICBM.sendButton == SendButtonState.increase
decel = self.ICBM.sendButton == SendButtonState.decrease
if CS.button_counter != self.last_button_frame:
self.last_button_frame = CS.button_counter
if ram_cars:
can_sends.append(chryslercan.create_cruise_buttons(packer, CS.button_counter, das_bus,
accel=accel, decel=decel))
else:
self.button_frame += 1
button_counter_offset = [1, 1, 0, None][self.button_frame % 4]
if button_counter_offset is not None:
can_sends.append(chryslercan.create_cruise_buttons(packer, CS.button_counter + button_counter_offset, das_bus,
accel=accel, decel=decel))
return can_sends
@@ -0,0 +1,92 @@
"""
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 collections import namedtuple
from opendbc.car import Bus, structs
from opendbc.car.chrysler.values import RAM_CARS
from opendbc.sunnypilot.mads_base import MadsCarStateBase
from opendbc.can.parser import CANParser
MadsDataSP = namedtuple("MadsDataSP",
["enable_mads", "paused", "lkas_disabled"])
ButtonType = structs.CarState.ButtonEvent.Type
class MadsCarController:
def __init__(self):
self.mads = MadsDataSP(False, False, False)
@staticmethod
def create_lkas_heartbit(packer, lkas_heartbit, mads):
# LKAS_HEARTBIT (0x2D9) LKAS heartbeat
values = {s: lkas_heartbit[s] for s in [
"LKAS_DISABLED",
"AUTO_HIGH_BEAM",
"FORWARD_1",
"FORWARD_2",
"FORWARD_3",
]}
if mads.enable_mads:
values["LKAS_DISABLED"] = 1 if mads.lkas_disabled else 0
return packer.make_can_msg("LKAS_HEARTBIT", 0, values)
@staticmethod
def mads_status_update(CC: structs.CarControl, CC_SP: structs.CarControlSP, CS) -> MadsDataSP:
enable_mads = CC_SP.mads.available
paused = CC_SP.mads.enabled and not CC.latActive
if any(be.type == ButtonType.lkas and be.pressed for be in CS.out.buttonEvents):
CS.lkas_disabled = not CS.lkas_disabled
return MadsDataSP(enable_mads, paused, CS.lkas_disabled)
def update(self, CC: structs.CarControl, CC_SP: structs.CarControlSP, CS) -> None:
self.mads = self.mads_status_update(CC, CC_SP, CS)
class MadsCarState(MadsCarStateBase):
def __init__(self, CP: structs.CarParams, CP_SP: structs.CarParamsSP):
super().__init__(CP, CP_SP)
self.lkas_heartbit = 0
self.init_lkas_disabled = False
self.lkas_disabled = False
@staticmethod
def get_parser(CP, pt_messages, cam_messages) -> None:
if CP.carFingerprint in RAM_CARS:
pt_messages += [
("Center_Stack_2", 1),
]
else:
pt_messages.append(("TRACTION_BUTTON", 1))
cam_messages.append(("LKAS_HEARTBIT", 1))
def get_lkas_button(self, cp, cp_cam):
if self.CP.carFingerprint in RAM_CARS:
lkas_button = cp.vl["Center_Stack_2"]["LKAS_Button"]
else:
lkas_button = cp.vl["TRACTION_BUTTON"]["TOGGLE_LKAS"]
self.lkas_heartbit = cp_cam.vl["LKAS_HEARTBIT"]
if not self.init_lkas_disabled:
self.lkas_disabled = cp_cam.vl["LKAS_HEARTBIT"]["LKAS_DISABLED"]
self.init_lkas_disabled = True
return lkas_button
def update_mads(self, ret: structs.CarState, can_parsers: dict[StrEnum, CANParser]) -> None:
cp = can_parsers[Bus.pt]
cp_cam = can_parsers[Bus.cam]
self.prev_lkas_button = self.lkas_button
self.lkas_button = self.get_lkas_button(cp, cp_cam)
@@ -0,0 +1,25 @@
"""
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 enum import IntFlag
from opendbc.car import structs
ButtonType = structs.CarState.ButtonEvent.Type
Button = namedtuple('Button', ['event_type', 'can_addr', 'can_msg', 'values'])
BUTTONS = [
Button(ButtonType.accelCruise, "CRUISE_BUTTONS", "ACC_Accel", [1]),
Button(ButtonType.decelCruise, "CRUISE_BUTTONS", "ACC_Decel", [1]),
Button(ButtonType.cancel, "CRUISE_BUTTONS", "ACC_Cancel", [1]),
Button(ButtonType.resumeCruise, "CRUISE_BUTTONS", "ACC_Resume", [1]),
]
class ChryslerFlagsSP(IntFlag):
NO_MIN_STEERING_SPEED = 1