mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-10-29 01:23:58 +08:00
Remove duplicate Ioniq 6 blind-spot sound alias
This commit is contained in:
@@ -25,7 +25,8 @@ def rear_body(status: BlindspotStatus) -> bytes:
|
||||
body = bytearray(REAR_NEUTRAL_BODY)
|
||||
body[3] = int(bool(left or right)) | (left << 6)
|
||||
body[4] = right
|
||||
body[5] = left << 1
|
||||
# The legacy FL_INDICATOR alias overlaps the right sound-warning field.
|
||||
# Mirror lamps have their own indication bits below.
|
||||
body[6] = right << 5
|
||||
body[7] = 0x80 | (max(left, right) << 3)
|
||||
body[16] = left | (right << 2)
|
||||
|
||||
@@ -28,14 +28,25 @@ def long_params():
|
||||
|
||||
|
||||
class TestIoniq6BlindspotStatus(unittest.TestCase):
|
||||
def test_all_sixteen_frozen_executable_outputs_and_integrity(self):
|
||||
def test_all_sixteen_reference_outputs_without_overlapping_sound_alias(self):
|
||||
for case in CASES:
|
||||
with self.subTest(case=case):
|
||||
left = 1 + int(case["leftBlinker"]) if case["left"] else 0
|
||||
right = 1 + int(case["rightBlinker"]) if case["right"] else 0
|
||||
frames = create_ioniq6_blindspot_status(case["counter"], BlindspotStatus(left, right))
|
||||
self.assertEqual([(addr, bus) for addr, _, bus in frames], [(0x1BA, 1), (0x1E5, 1)])
|
||||
self.assertEqual([payload.hex() for _, payload, _ in frames], [case["rear"], case["front"]])
|
||||
expected_rear = bytearray.fromhex(case["rear"])
|
||||
expected_rear[5] = 0 # Retired FL_INDICATOR alias overlaps BCW_RtSndWrngSta.
|
||||
expected_rear[:2] = hkg_can_fd_checksum(0x1BA, None, expected_rear).to_bytes(2, "little")
|
||||
self.assertEqual([payload.hex() for _, payload, _ in frames], [expected_rear.hex(), case["front"]])
|
||||
rear = frames[0][1]
|
||||
sound_word = int.from_bytes(rear, "little")
|
||||
self.assertEqual((sound_word >> 34) & 0x3, 0)
|
||||
self.assertEqual((sound_word >> 36) & 0x3ff, 0)
|
||||
self.assertEqual(rear[16] & 3, left)
|
||||
self.assertEqual((rear[16] >> 2) & 0x3f, right)
|
||||
self.assertEqual((rear[3] >> 6) & 3, left)
|
||||
self.assertEqual(rear[4] & 3, right)
|
||||
for addr, payload, _ in frames:
|
||||
self.assertEqual(int.from_bytes(payload[:2], "little"), hkg_can_fd_checksum(addr, None, bytearray(payload)))
|
||||
|
||||
|
||||
@@ -13,8 +13,10 @@ no recorded routes, VINs, or location data.
|
||||
combinations from the reference blind-spot encoder, using a
|
||||
synthetic neutral base and counters 0–15. The frozen indicator mirror bits
|
||||
remain in the raw payload even though the current DBC omits their names; one
|
||||
alias is decoded as a sound-warning field, so this fixture proves bytes,
|
||||
not audible behavior.
|
||||
alias overlaps the right sound-warning field. The test intentionally clears
|
||||
only that retired alias and regenerates its checksum, while preserving the
|
||||
original fixture as provenance. It checks mirror/BCW indication separately;
|
||||
the fixture does not prove audible behavior.
|
||||
- `scc_parent_frames.json` records the default SCC packer's output before the
|
||||
Ioniq-specific options were added. Other vehicles retain these defaults.
|
||||
|
||||
|
||||
@@ -972,7 +972,7 @@ static bool hyundai_canfd_tx_hook_valid(const CANPacket_t *msg) {
|
||||
uint8_t body[24] = {0};
|
||||
body[3] = ((left || right) ? 1U : 0U) | (left << 6U);
|
||||
body[4] = right;
|
||||
body[5] = left << 1U;
|
||||
// Retired FL_INDICATOR overlaps the right sound-warning bits; require zero.
|
||||
body[6] = right << 5U;
|
||||
body[7] = 0x80U | (SAFETY_MAX(left, right) << 3U);
|
||||
body[16] = left | (right << 2U);
|
||||
|
||||
@@ -181,6 +181,29 @@ class TestHyundaiIoniq6Long(unittest.TestCase):
|
||||
self.assertTrue(self.safety.get_relay_malfunction())
|
||||
self.assertFalse(self.safety.safety_tx_hook(self.packet(rear)))
|
||||
|
||||
def test_bsm_legacy_indicator_sound_alias_is_rejected(self):
|
||||
for raw in (*RAW_LONG.values(), *RAW_AOL.values()):
|
||||
for left_lamp in (False, True):
|
||||
with self.subTest(raw=hex(raw), left_lamp=left_lamp):
|
||||
self.mode(raw)
|
||||
_, cp = params("lkas_alt" if raw & 0x80 else "lkas")
|
||||
packer = CANPacker(DBC[cp.carFingerprint][Bus.pt])
|
||||
self.bsm_physical(packer, left=True, left_lamp=left_lamp)
|
||||
level = 1 + int(left_lamp)
|
||||
rear, front = create_ioniq6_blindspot_status(3, BlindspotStatus(level, 0))
|
||||
self.assertEqual(rear[1][5], 0)
|
||||
legacy = bytearray(rear[1])
|
||||
legacy[5] = level << 1
|
||||
legacy[:2] = hkg_can_fd_checksum(0x1BA, None, legacy).to_bytes(2, "little")
|
||||
self.assertFalse(self.safety.safety_tx_hook(self.packet((0x1BA, bytes(legacy), 1))))
|
||||
self.assertFalse(self.safety.safety_tx_hook(self.packet(front)))
|
||||
if self.release:
|
||||
self.assertFalse(self.safety.safety_tx_hook(self.packet(rear)))
|
||||
self.assertFalse(self.safety.safety_tx_hook(self.packet(front)))
|
||||
else:
|
||||
self.assertTrue(self.safety.safety_tx_hook(self.packet(rear)))
|
||||
self.assertTrue(self.safety.safety_tx_hook(self.packet(front)))
|
||||
|
||||
def test_bsm_valid_crc_cannot_hide_altered_status_body(self):
|
||||
if self.release:
|
||||
self.skipTest("RELEASE denies all four exact Ioniq 6 LONG profiles")
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
extern const uint8_t gitversion[29];
|
||||
const uint8_t gitversion[29] = "DEV-6e45ecc0-Pa5919516-DEBUG";
|
||||
const uint8_t gitversion[29] = "DEV-03ca7263-Pa5919516-DEBUG";
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
DEV-6e45ecc0-Pa5919516-DEBUG
|
||||
DEV-03ca7263-Pa5919516-DEBUG
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "cfaabf7b3685cfb3b93666605271972ef753096ae8c1c787a7ae5a42c627fbe2", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "e85babf7279be72dc647b70a9128be20822dff6482032814608abff6c091ad2f", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user