mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 06:43:41 +08:00
Use the camera cruise bus on the 2026 Hyundai i30
This commit is contained in:
@@ -147,10 +147,11 @@ class CarInterface(CarInterfaceBase):
|
||||
exact = {(fw.ecu.raw, fw.address, None): bytes(fw.fwVersion) for fw in car_fw
|
||||
if fw.subAddress == 0 and bytes(fw.fwVersion).startswith(b"\xf1\x00")}
|
||||
qualified = (not is_release and all(exact.get(key) in versions for key, versions in expected.items()) and
|
||||
fingerprint[0].get(0x421) == 8 and fingerprint[2].get(0x340) == 8 and
|
||||
fingerprint[2].get(0x420) == 8 and fingerprint[2].get(0x421) == 8 and
|
||||
fingerprint[2].get(0x340) == 8 and
|
||||
fingerprint[2].get(0x485) == 8)
|
||||
if qualified:
|
||||
ret.flags |= HyundaiFlags.CHECKSUM_CRC8.value
|
||||
ret.flags |= (HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.CAMERA_SCC).value
|
||||
|
||||
if i30 and not qualified:
|
||||
# Controls may construct a PID for this profile. Keep it inert with valid gains.
|
||||
|
||||
@@ -778,6 +778,7 @@ static safety_config hyundai_init(uint16_t safety_param) {
|
||||
};
|
||||
|
||||
hyundai_common_init(param);
|
||||
hyundai_camera_scc |= hyundai_i30_2026;
|
||||
hyundai_daw_init(false, false);
|
||||
if ((param == 0x800EU) && (alternative_experience == 0)) {
|
||||
hyundai_long_main_policy = HYUNDAI_MAIN_TRACK;
|
||||
@@ -1115,10 +1116,10 @@ static safety_config hyundai_legacy_init(uint16_t param) {
|
||||
}
|
||||
|
||||
static void hyundai_optional_rx_hook(const CANPacket_t *msg) {
|
||||
if (hyundai_i30_2026 && (msg->bus == 2U)) {
|
||||
if (msg->addr == 0x421U) {
|
||||
if (hyundai_i30_2026) {
|
||||
if ((msg->bus == 0U) && (msg->addr == 0x421U)) {
|
||||
hyundai_i30_topology_conflict = true;
|
||||
} else if (msg->addr == 0x340U) {
|
||||
} else if ((msg->bus == 2U) && (msg->addr == 0x340U)) {
|
||||
const uint32_t now = microsecond_timer_get();
|
||||
const uint8_t counter = msg->data[4] >> 4U;
|
||||
const bool valid = hyundai_i30_lkas_checksum_valid(msg);
|
||||
|
||||
Executable → Regular
+5
-2
@@ -597,7 +597,8 @@ class TestHyundaiI30StockCruiseSafety(unittest.TestCase):
|
||||
("SCC12", {"ACCMode": 1}, checksum),
|
||||
)
|
||||
for name, values, fix_checksum in frames:
|
||||
self.assertTrue(self.safety.safety_rx_hook(self.packer.make_can_msg_safety(name, 0, values, fix_checksum=fix_checksum)))
|
||||
bus = 2 if name == "SCC12" else 0
|
||||
self.assertTrue(self.safety.safety_rx_hook(self.packer.make_can_msg_safety(name, bus, values, fix_checksum=fix_checksum)))
|
||||
self.assertTrue(self.safety.get_controls_allowed())
|
||||
self.assertTrue(self.safety.safety_config_valid())
|
||||
|
||||
@@ -626,7 +627,9 @@ class TestHyundaiI30StockCruiseSafety(unittest.TestCase):
|
||||
for count in (4, 5):
|
||||
self.assertTrue(self.safety.safety_rx_hook(self._lkas(2, count)))
|
||||
self.assertTrue(self.safety.safety_tx_hook(self._lkas(0, 1, torque=1, request=True)))
|
||||
self.assertTrue(self.safety.safety_rx_hook(common.make_msg(2, 0x421, 8)))
|
||||
for addr in (0x38D, 0x420, 0x421, 0x485):
|
||||
self.assertEqual(self.safety.safety_fwd_packet_hook(common.make_msg(2, addr, 8)), 0)
|
||||
self.assertTrue(self.safety.safety_rx_hook(common.make_msg(0, 0x421, 8)))
|
||||
self.assertEqual(self.safety.safety_fwd_packet_hook(self._lkas(2, 6)), 0)
|
||||
self.assertFalse(self.safety.safety_tx_hook(self._lkas(0, 2, torque=1, request=True)))
|
||||
self.assertFalse(self.safety.safety_tx_hook(common.make_msg(0, 0x421, 8)))
|
||||
|
||||
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-1594114e-Pf38f504f-DEBUG";
|
||||
const uint8_t gitversion[29] = "DEV-6bd89852-Pf38f504f-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-1594114e-Pf38f504f-DEBUG
|
||||
DEV-6bd89852-Pf38f504f-DEBUG
|
||||
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "32df6b573bdccda013068e8586134d52c790f50f67a522a2b95aae91ba0acb07", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "dc2f3fe6258278021953e323b6c4f513d40ae604f9f6a8a05ddc42c0e5a13f43", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user