mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-25 12:02:05 +08:00
Support Driving Personality change
This commit is contained in:
@@ -138,7 +138,7 @@ class CarController(CarControllerBase):
|
||||
if can_canfd:
|
||||
can_sends.extend(hyundaicanfd.create_acc_commands_can_canfd(self.packer, self.CAN, CC.enabled, accel,
|
||||
int(self.frame / 2), hud_control.leadVisible,
|
||||
set_speed_in_units, stopping, CC.cruiseControl.override))
|
||||
set_speed_in_units, stopping, CC.cruiseControl.override, hud_control))
|
||||
else:
|
||||
can_sends.append(hyundaicanfd.create_acc_control(self.packer, self.CAN, CC.enabled, self.accel_last, accel, stopping, CC.cruiseControl.override,
|
||||
set_speed_in_units, hud_control))
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
from openpilot.common.numpy_fast import clip
|
||||
from openpilot.selfdrive.car import CanBusBase
|
||||
from openpilot.selfdrive.car.hyundai.hyundaican import hyundai_checksum
|
||||
from openpilot.selfdrive.car.hyundai.values import HyundaiFlags
|
||||
from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, TauGapSetCanCanfd
|
||||
|
||||
DISTANCE_DICT_CAN_CANFD = {3: TauGapSetCanCanfd.DISTANCE_3, 2: TauGapSetCanCanfd.DISTANCE_2, 1: TauGapSetCanCanfd.DISTANCE_1}
|
||||
|
||||
|
||||
class CanBus(CanBusBase):
|
||||
@@ -192,7 +194,7 @@ def create_acc_control(packer, CAN, enabled, accel_last, accel, stopping, gas_ov
|
||||
return packer.make_can_msg("SCC_CONTROL", CAN.ECAN, values)
|
||||
|
||||
|
||||
def create_acc_commands_can_canfd(packer, CAN, enabled, accel, idx, lead_visible, set_speed, stopping, long_override):
|
||||
def create_acc_commands_can_canfd(packer, CAN, enabled, accel, idx, lead_visible, set_speed, stopping, long_override, hud_control):
|
||||
ret = []
|
||||
|
||||
msg_values = [
|
||||
@@ -205,7 +207,7 @@ def create_acc_commands_can_canfd(packer, CAN, enabled, accel, idx, lead_visible
|
||||
|
||||
("SCC12", {
|
||||
"MainMode_ACC": 1,
|
||||
"TauGapSet": 6,
|
||||
"TauGapSet": DISTANCE_DICT_CAN_CANFD.get(hud_control.leadDistanceBars, TauGapSetCanCanfd.DISTANCE_3),
|
||||
"VSetDis": set_speed if enabled else 0,
|
||||
"ObjValid": 0,
|
||||
"ACC_ObjDist": 1,
|
||||
|
||||
@@ -563,6 +563,13 @@ class Buttons:
|
||||
CANCEL = 4 # on newer models, this is a pause/resume button
|
||||
|
||||
|
||||
class TauGapSetCanCanfd:
|
||||
DISTANCE_4 = 1
|
||||
DISTANCE_3 = 0
|
||||
DISTANCE_2 = 7
|
||||
DISTANCE_1 = 6
|
||||
|
||||
|
||||
def get_platform_codes(fw_versions: list[bytes]) -> set[tuple[bytes, bytes | None]]:
|
||||
# Returns unique, platform-specific identification codes for a set of versions
|
||||
codes = set() # (code-Optional[part], date)
|
||||
|
||||
Reference in New Issue
Block a user