mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-01 19:42:07 +08:00
EV6 blinkers (#26618)
* right blink * left blink * rm debug * just the support code * revert panda * behind flag old-commit-hash: c9b8f6457e8973adb37bb7168871b496cb76f43c
This commit is contained in:
+1
-1
Submodule opendbc updated: 94fff4782b...1f8aa057bc
@@ -83,11 +83,16 @@ class CarController:
|
||||
|
||||
# tester present - w/ no response (keeps relevant ECU disabled)
|
||||
if self.frame % 100 == 0 and not (self.CP.flags & HyundaiFlags.CANFD_CAMERA_SCC.value) and self.CP.openpilotLongitudinalControl:
|
||||
# for longitudinal control, either radar or ADAS driving ECU
|
||||
addr, bus = 0x7d0, 0
|
||||
if self.CP.flags & HyundaiFlags.CANFD_HDA2.value:
|
||||
addr, bus = 0x730, 5
|
||||
can_sends.append([addr, 0, b"\x02\x3E\x80\x00\x00\x00\x00\x00", bus])
|
||||
|
||||
# for blinkers
|
||||
if self.CP.flags & HyundaiFlags.ENABLE_BLINKERS:
|
||||
can_sends.append([0x7b1, 0, b"\x02\x3E\x80\x00\x00\x00\x00\x00", 5])
|
||||
|
||||
# >90 degree steering fault prevention
|
||||
# Count up to MAX_ANGLE_FRAMES, at which point we need to cut torque to avoid a steering fault
|
||||
if CC.latActive and abs(CS.out.steeringAngleDeg) >= MAX_ANGLE:
|
||||
@@ -118,6 +123,10 @@ class CarController:
|
||||
if self.frame % 5 == 0 and (not hda2 or hda2_long):
|
||||
can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CP, CC.enabled))
|
||||
|
||||
# blinkers
|
||||
if hda2 and self.CP.flags & HyundaiFlags.ENABLE_BLINKERS:
|
||||
can_sends.extend(hyundaicanfd.create_spas_messages(self.packer, self.frame, False, False))
|
||||
|
||||
if self.CP.openpilotLongitudinalControl:
|
||||
if hda2:
|
||||
can_sends.extend(hyundaicanfd.create_adrv_messages(self.packer, self.frame))
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from common.numpy_fast import clip
|
||||
from selfdrive.car.hyundai.values import HyundaiFlags
|
||||
|
||||
|
||||
def get_e_can_bus(CP):
|
||||
# On the CAN-FD platforms, the LKAS camera is on both A-CAN and E-CAN. HDA2 cars
|
||||
# have a different harness than the HDA1 and non-HDA variants in order to split
|
||||
@@ -98,6 +97,25 @@ def create_acc_control(packer, CP, enabled, accel_last, accel, stopping, gas_ove
|
||||
return packer.make_can_msg("SCC_CONTROL", get_e_can_bus(CP), values)
|
||||
|
||||
|
||||
def create_spas_messages(packer, frame, left_blink, right_blink):
|
||||
ret = []
|
||||
|
||||
values = {
|
||||
}
|
||||
ret.append(packer.make_can_msg("SPAS1", 5, values))
|
||||
|
||||
blink = 0
|
||||
if left_blink:
|
||||
blink = 3
|
||||
elif right_blink:
|
||||
blink = 4
|
||||
values = {
|
||||
"BLINKER_CONTROL": blink,
|
||||
}
|
||||
ret.append(packer.make_can_msg("SPAS2", 5, values))
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def create_adrv_messages(packer, frame):
|
||||
# messages needed to car happy after disabling
|
||||
|
||||
@@ -287,6 +287,10 @@ class CarInterface(CarInterfaceBase):
|
||||
addr, bus = 0x730, 5
|
||||
disable_ecu(logcan, sendcan, bus=bus, addr=addr, com_cont_req=b'\x28\x83\x01')
|
||||
|
||||
# for blinkers
|
||||
if CP.flags & HyundaiFlags.ENABLE_BLINKERS:
|
||||
disable_ecu(logcan, sendcan, bus=5, addr=0x7B1, com_cont_req=b'\x28\x83\x01')
|
||||
|
||||
def _update(self, c):
|
||||
ret = self.CS.update(self.cp, self.cp_cam)
|
||||
|
||||
|
||||
@@ -58,6 +58,8 @@ class HyundaiFlags(IntFlag):
|
||||
|
||||
ALT_LIMITS = 16
|
||||
|
||||
ENABLE_BLINKERS = 32
|
||||
|
||||
|
||||
class CAR:
|
||||
# Hyundai
|
||||
|
||||
Reference in New Issue
Block a user