This commit is contained in:
firestar5683
2026-04-26 17:14:39 -05:00
parent 31fefd8eb8
commit da61e79f2e
5 changed files with 95 additions and 2 deletions
@@ -244,6 +244,12 @@ class CarController(CarControllerBase):
CS.right_blindspot_from_radar,
CC.leftBlinker,
CC.rightBlinker))
if self.CP.carFingerprint == CAR.HYUNDAI_IONIQ_6:
can_sends.extend(hyundaicanfd.create_ioniq_6_cluster_blindspot_messages(self.CAN, self.frame,
CS.left_blindspot_from_radar,
CS.right_blindspot_from_radar,
CC.leftBlinker,
CC.rightBlinker))
if self.frame % 2 == 0:
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))
@@ -229,6 +229,68 @@ def create_blindspot_status_messages(packer, CAN, rear_values, front_corner_valu
]
IONIQ_6_CLUSTER_BLINDSPOT_31A = {
"right": (
bytes.fromhex("fa7c10f0f0ffff03898aff0b0a8678ff000000007e0055550000000000000000"),
bytes.fromhex("ac0e11f0f0ffff03898aff0c0a8678ff000000007e0055550000000000000000"),
bytes.fromhex("76ce12f0f0ffff03898aff0b0a8678ff000000007e0055550000000000000000"),
bytes.fromhex("309713f0f0ffff03898aff0b0a8678ff000000007e0055550000000000000000"),
bytes.fromhex("d32214f0f0ffff03898aff0c0a8678ff000000007e0055550000000000000000"),
bytes.fromhex("957b15f0f0ffff03898aff0c0a8678ff000000007e0055550000000000000000"),
),
"left": (
bytes.fromhex("851828f0f0ffff03898aff0a098678ff000000007e0055550000000000000000"),
bytes.fromhex("c34129f0f0ffff03898aff0a098678ff000000007e0055550000000000000000"),
bytes.fromhex("09aa2af0f0ffff03898aff0a098678ff000000007e0055550000000000000000"),
bytes.fromhex("4ff32bf0f0ffff03898aff0a098678ff000000007e0055550000000000000000"),
bytes.fromhex("bc6d2cf0f0ffff03898aff0a098678ff000000007e0055550000000000000000"),
bytes.fromhex("fa342df0f0ffff03898aff0a098678ff000000007e0055550000000000000000"),
),
}
IONIQ_6_CLUSTER_BLINDSPOT_3B5 = {
"right": (
bytes.fromhex("caa95c00000000464600000000000000d7020000000069070000000000000000"),
bytes.fromhex("8cf05d00000000464600000000000000d7020000000069070000000000000000"),
bytes.fromhex("461b5e00000000464600000000000000d7020000000069070000000000000000"),
bytes.fromhex("00425f00000000464600000000000000d7020000000069070000000000000000"),
),
"left": (
bytes.fromhex("2c69c500000000464600000000000000da020000000069070000000000000000"),
bytes.fromhex("e682c600000000464600000000000000da020000000069070000000000000000"),
bytes.fromhex("21afc800000000464600000000000000da020000000069070000000000000000"),
bytes.fromhex("67f6c900000000464600000000000000da020000000069070000000000000000"),
),
}
def create_ioniq_6_cluster_blindspot_messages(CAN, frame, left_blindspot=False, right_blindspot=False,
left_blinker=False, right_blinker=False):
side = None
if left_blindspot and not right_blindspot:
side = "left"
elif right_blindspot and not left_blindspot:
side = "right"
elif left_blindspot and right_blindspot:
if left_blinker and not right_blinker:
side = "left"
elif right_blinker and not left_blinker:
side = "right"
if side is None:
return []
ret = []
if frame % 20 == 0:
seq_3b5 = IONIQ_6_CLUSTER_BLINDSPOT_3B5[side]
ret.append((0x3B5, seq_3b5[(frame // 20) % len(seq_3b5)], CAN.ECAN))
if frame % 100 == 0:
seq_31a = IONIQ_6_CLUSTER_BLINDSPOT_31A[side]
ret.append((0x31A, seq_31a[(frame // 100) % len(seq_31a)], CAN.ECAN))
return ret
def create_acc_control(packer, CAN, enabled, accel_last, accel, stopping, gas_override, set_speed, hud_control):
jerk = 5
jn = jerk / 50
@@ -358,6 +358,28 @@ class TestHyundaiFingerprint:
assert decode_ioniq_6_blindspot_radar_state(0x1A) == (True, True)
assert decode_ioniq_6_blindspot_radar_state(10.0) == (False, True)
def test_ioniq_6_cluster_blindspot_helper_uses_captured_stock_sequences(self):
CP = CarParams.new_message()
CP.carFingerprint = CAR.HYUNDAI_IONIQ_6
CP.flags = int(HyundaiFlags.CANFD | HyundaiFlags.CANFD_LKA_STEERING)
can_bus = CanBus(CP)
right_msgs = hyundaicanfd.create_ioniq_6_cluster_blindspot_messages(can_bus, 0, False, True)
assert right_msgs == [
(0x3B5, bytes.fromhex("caa95c00000000464600000000000000d7020000000069070000000000000000"), can_bus.ECAN),
(0x31A, bytes.fromhex("fa7c10f0f0ffff03898aff0b0a8678ff000000007e0055550000000000000000"), can_bus.ECAN),
]
left_msgs = hyundaicanfd.create_ioniq_6_cluster_blindspot_messages(can_bus, 100, True, False)
assert left_msgs == [
(0x3B5, bytes.fromhex("e682c600000000464600000000000000da020000000069070000000000000000"), can_bus.ECAN),
(0x31A, bytes.fromhex("c34129f0f0ffff03898aff0a098678ff000000007e0055550000000000000000"), can_bus.ECAN),
]
both_msgs = hyundaicanfd.create_ioniq_6_cluster_blindspot_messages(can_bus, 0, True, True)
assert both_msgs == []
def test_sportage_angle_jerk_override_is_scoped(self):
sportage = CarParams.new_message()
sportage.carFingerprint = CAR.KIA_SPORTAGE_HEV_2026
@@ -27,6 +27,8 @@
#define HYUNDAI_CANFD_BLINDSPOT_DASH_TX_MSGS(e_can) \
{0x1BA, e_can, 24, .check_relay = false}, /* BLINDSPOTS_REAR_CORNERS */ \
{0x1E5, e_can, 16, .check_relay = false}, /* BLINDSPOTS_FRONT_CORNER_1 */ \
{0x31A, e_can, 32, .check_relay = false}, /* cluster blindspot overlay */ \
{0x3B5, e_can, 32, .check_relay = false}, /* cluster blindspot overlay */ \
// *** Addresses checked in rx hook ***
// EV, ICE, HYBRID: ACCELERATOR (0x35), ACCELERATOR_BRAKE_ALT (0x100), ACCELERATOR_ALT (0x105)
@@ -451,7 +451,8 @@ class TestHyundaiCanfdLKASteeringAltEV(TestHyundaiCanfdBase):
class TestHyundaiCanfdLKASteeringLongEV(HyundaiLongitudinalBase, TestHyundaiCanfdLKASteeringEV):
TX_MSGS = [[0x50, 0], [0x1CF, 1], [0x2A4, 0], [0x51, 0], [0x730, 1], [0x12a, 1], [0x160, 1],
[0x1ba, 1], [0x1e0, 1], [0x1e5, 1], [0x1a0, 1], [0x1ea, 1], [0x200, 1], [0x345, 1], [0x1da, 1]]
[0x1ba, 1], [0x1e0, 1], [0x1e5, 1], [0x31a, 1], [0x3b5, 1],
[0x1a0, 1], [0x1ea, 1], [0x200, 1], [0x345, 1], [0x1da, 1]]
RELAY_MALFUNCTION_ADDRS = {0: (0x50, 0x2a4), 1: (0x1a0,)} # LKAS, CAM_0x2A4, SCC_CONTROL
@@ -480,7 +481,7 @@ class TestHyundaiCanfdLKASteeringLongEV(HyundaiLongitudinalBase, TestHyundaiCanf
# Tests longitudinal for ICE, hybrid, EV cars with LFA steering
class TestHyundaiCanfdLFASteeringLongBase(HyundaiLongitudinalBase, TestHyundaiCanfdLFASteeringBase):
TX_MSGS = [[0x12A, 0], [0x1A0, 1], [0x1CF, 0], [0x1E0, 0], [0x1BA, 0], [0x1E5, 0]]
TX_MSGS = [[0x12A, 0], [0x1A0, 1], [0x1CF, 0], [0x1E0, 0], [0x1BA, 0], [0x1E5, 0], [0x31A, 0], [0x3B5, 0]]
FWD_BLACKLISTED_ADDRS = {2: [0x12a, 0xcb, 0x1e0, 0x1a0, 0x160]}
RELAY_MALFUNCTION_ADDRS = {0: (0x12A, 0xCB, 0x1E0, 0x1a0, 0x160)} # LFA, ADAS_CMD_35_10ms, LFAHDA_CLUSTER, SCC_CONTROL, ADRV_0x160