diff --git a/opendbc_repo/opendbc/safety/modes/hyundai_canfd.h b/opendbc_repo/opendbc/safety/modes/hyundai_canfd.h index 1695395812..f89625d650 100644 --- a/opendbc_repo/opendbc/safety/modes/hyundai_canfd.h +++ b/opendbc_repo/opendbc/safety/modes/hyundai_canfd.h @@ -1359,6 +1359,22 @@ static bool hyundai_kona_camera_output(const CANPacket_t *msg, CANPacket_t *outp } } hyundai_kona_pending = false; + if (!*replaced && authority && consecutive && hyundai_kona_slot_owned) { + // Keep the camera's status and counter without repeating old host torque. + CANPacket_t neutral = *msg; + neutral.data[5] &= 0x01U; + neutral.data[6] = (neutral.data[6] & 0xC0U) | 0x08U; + const uint16_t checksum = hyundai_common_canfd_compute_checksum(&neutral) ^ 0x041DU; + neutral.data[0] = (uint8_t)checksum; + neutral.data[1] = (uint8_t)(checksum >> 8U); + neutral.bus = 0U; + hyundai_kona_emitting = true; + *replaced = safety_tx_hook(&neutral); + hyundai_kona_emitting = false; + if (*replaced) { + *output = neutral; + } + } if (!*replaced) { const bool camera_neutral = ((msg->data[6] & 0x3FU) == 0x08U) && ((msg->data[5] & 0xFEU) == 0U); blocked = (hyundai_kona_slot_owned && !camera_neutral) || diff --git a/opendbc_repo/opendbc/safety/tests/test_hyundai_kona_ccnc_handoff.py b/opendbc_repo/opendbc/safety/tests/test_hyundai_kona_ccnc_handoff.py index 08be7d5824..f201f7c33f 100644 --- a/opendbc_repo/opendbc/safety/tests/test_hyundai_kona_ccnc_handoff.py +++ b/opendbc_repo/opendbc/safety/tests/test_hyundai_kona_ccnc_handoff.py @@ -113,3 +113,38 @@ class TestHyundaiKonaCcncHandoff(unittest.TestCase): self.safety.set_relay_malfunction(True) self.assertEqual(self.forward(following)[0], -1) self.assertFalse(self.safety.safety_stage_tx_hook(host)) + + def test_empty_owned_slot_uses_neutral_camera_status(self): + if self.safety.set_safety_hooks(structs.CarParams.SafetyModel.allOutput, 0) != 0: + self.skipTest('Kona factory handoff is DEBUG only') + self.mode(0x1C0C) + self.safety.set_timer(1_000_000) + for status in self.safety.rx_status: + status.msg_seen = True + status.valid_checksum = True + status.valid_quality_flag = True + status.last_timestamp = 1_000_000 + self.assertEqual(self.forward(self.packet(2, '784d1400000108f0000a000000640000'))[:2], (0, False)) + self.safety.set_controls_allowed(True) + self.safety.set_aol_test_heartbeat(True) + self.safety.aol_set_host_request(3) + host = self.packet(0, 'a009150280001800000a000000900000') + host[0].data[2] = 20 + from opendbc.car.hyundai.hyundaicanfd import hkg_can_fd_checksum + crc = hkg_can_fd_checksum(0x12A, None, bytearray(host[0].data[0:16])) + host[0].data[0], host[0].data[1] = crc & 255, crc >> 8 + self.safety.set_timer(1_005_000) + self.assertTrue(self.safety.safety_stage_tx_hook(host)) + self.safety.set_timer(1_010_000) + self.assertEqual(self.forward(self.packet(2, '5ce51500000108f0000a000000640000'))[:2], (0, True)) + + self.safety.set_timer(1_019_900) + camera = self.packet(2, '110d1600000108f0000a000000640000') + bus, replaced, output = self.forward(camera) + self.assertEqual((bus, replaced), (0, True)) + self.assertTrue(output[0].fd) + self.assertEqual(output[0].data[2], 22) + self.assertEqual(output[0].data[5] & 0xFE, 0) + self.assertEqual(output[0].data[6] & 0x3F, 8) + self.assertEqual(output[0].data[7], camera[0].data[7]) + self.assertEqual(self.forward(camera)[0], -1) diff --git a/panda/board/obj/body_h7.bin.signed b/panda/board/obj/body_h7.bin.signed index b330c62f5d..ac458d0110 100644 Binary files a/panda/board/obj/body_h7.bin.signed and b/panda/board/obj/body_h7.bin.signed differ diff --git a/panda/board/obj/bootstub.body_h7.bin b/panda/board/obj/bootstub.body_h7.bin index ff234f19b7..b06ac531e4 100644 Binary files a/panda/board/obj/bootstub.body_h7.bin and b/panda/board/obj/bootstub.body_h7.bin differ diff --git a/panda/board/obj/bootstub.panda.bin b/panda/board/obj/bootstub.panda.bin index eb577f2c44..acec1613d8 100644 Binary files a/panda/board/obj/bootstub.panda.bin and b/panda/board/obj/bootstub.panda.bin differ diff --git a/panda/board/obj/bootstub.panda_can_ignition_only.bin b/panda/board/obj/bootstub.panda_can_ignition_only.bin index eb577f2c44..acec1613d8 100644 Binary files a/panda/board/obj/bootstub.panda_can_ignition_only.bin and b/panda/board/obj/bootstub.panda_can_ignition_only.bin differ diff --git a/panda/board/obj/bootstub.panda_h7.bin b/panda/board/obj/bootstub.panda_h7.bin index cc57374ea3..e23b3ee821 100644 Binary files a/panda/board/obj/bootstub.panda_h7.bin and b/panda/board/obj/bootstub.panda_h7.bin differ diff --git a/panda/board/obj/bootstub.panda_h7_can_ignition_only.bin b/panda/board/obj/bootstub.panda_h7_can_ignition_only.bin index cc57374ea3..e23b3ee821 100644 Binary files a/panda/board/obj/bootstub.panda_h7_can_ignition_only.bin and b/panda/board/obj/bootstub.panda_h7_can_ignition_only.bin differ diff --git a/panda/board/obj/bootstub.panda_h7_hkg_remote.bin b/panda/board/obj/bootstub.panda_h7_hkg_remote.bin index cc57374ea3..e23b3ee821 100644 Binary files a/panda/board/obj/bootstub.panda_h7_hkg_remote.bin and b/panda/board/obj/bootstub.panda_h7_hkg_remote.bin differ diff --git a/panda/board/obj/bootstub.panda_h7_hkg_remote_can_ignition_only.bin b/panda/board/obj/bootstub.panda_h7_hkg_remote_can_ignition_only.bin index cc57374ea3..e23b3ee821 100644 Binary files a/panda/board/obj/bootstub.panda_h7_hkg_remote_can_ignition_only.bin and b/panda/board/obj/bootstub.panda_h7_hkg_remote_can_ignition_only.bin differ diff --git a/panda/board/obj/bootstub.panda_h7_remote.bin b/panda/board/obj/bootstub.panda_h7_remote.bin index cc57374ea3..e23b3ee821 100644 Binary files a/panda/board/obj/bootstub.panda_h7_remote.bin and b/panda/board/obj/bootstub.panda_h7_remote.bin differ diff --git a/panda/board/obj/bootstub.panda_h7_remote_can_ignition_only.bin b/panda/board/obj/bootstub.panda_h7_remote_can_ignition_only.bin index cc57374ea3..e23b3ee821 100644 Binary files a/panda/board/obj/bootstub.panda_h7_remote_can_ignition_only.bin and b/panda/board/obj/bootstub.panda_h7_remote_can_ignition_only.bin differ diff --git a/panda/board/obj/bootstub.panda_h7_tesla_wake.bin b/panda/board/obj/bootstub.panda_h7_tesla_wake.bin index cc57374ea3..e23b3ee821 100644 Binary files a/panda/board/obj/bootstub.panda_h7_tesla_wake.bin and b/panda/board/obj/bootstub.panda_h7_tesla_wake.bin differ diff --git a/panda/board/obj/bootstub.panda_h7_tesla_wake_can_ignition_only.bin b/panda/board/obj/bootstub.panda_h7_tesla_wake_can_ignition_only.bin index cc57374ea3..e23b3ee821 100644 Binary files a/panda/board/obj/bootstub.panda_h7_tesla_wake_can_ignition_only.bin and b/panda/board/obj/bootstub.panda_h7_tesla_wake_can_ignition_only.bin differ diff --git a/panda/board/obj/bootstub.panda_hkg_remote.bin b/panda/board/obj/bootstub.panda_hkg_remote.bin index eb577f2c44..acec1613d8 100644 Binary files a/panda/board/obj/bootstub.panda_hkg_remote.bin and b/panda/board/obj/bootstub.panda_hkg_remote.bin differ diff --git a/panda/board/obj/bootstub.panda_hkg_remote_can_ignition_only.bin b/panda/board/obj/bootstub.panda_hkg_remote_can_ignition_only.bin index eb577f2c44..acec1613d8 100644 Binary files a/panda/board/obj/bootstub.panda_hkg_remote_can_ignition_only.bin and b/panda/board/obj/bootstub.panda_hkg_remote_can_ignition_only.bin differ diff --git a/panda/board/obj/bootstub.panda_remote.bin b/panda/board/obj/bootstub.panda_remote.bin index eb577f2c44..acec1613d8 100644 Binary files a/panda/board/obj/bootstub.panda_remote.bin and b/panda/board/obj/bootstub.panda_remote.bin differ diff --git a/panda/board/obj/bootstub.panda_remote_can_ignition_only.bin b/panda/board/obj/bootstub.panda_remote_can_ignition_only.bin index eb577f2c44..acec1613d8 100644 Binary files a/panda/board/obj/bootstub.panda_remote_can_ignition_only.bin and b/panda/board/obj/bootstub.panda_remote_can_ignition_only.bin differ diff --git a/panda/board/obj/bootstub.panda_tesla_wake.bin b/panda/board/obj/bootstub.panda_tesla_wake.bin index eb577f2c44..acec1613d8 100644 Binary files a/panda/board/obj/bootstub.panda_tesla_wake.bin and b/panda/board/obj/bootstub.panda_tesla_wake.bin differ diff --git a/panda/board/obj/bootstub.panda_tesla_wake_can_ignition_only.bin b/panda/board/obj/bootstub.panda_tesla_wake_can_ignition_only.bin index eb577f2c44..acec1613d8 100644 Binary files a/panda/board/obj/bootstub.panda_tesla_wake_can_ignition_only.bin and b/panda/board/obj/bootstub.panda_tesla_wake_can_ignition_only.bin differ diff --git a/panda/board/obj/panda.bin.signed b/panda/board/obj/panda.bin.signed index 526a776bc7..9556631b52 100644 Binary files a/panda/board/obj/panda.bin.signed and b/panda/board/obj/panda.bin.signed differ diff --git a/panda/board/obj/panda_can_ignition_only.bin.signed b/panda/board/obj/panda_can_ignition_only.bin.signed index 7ca3552ff4..ff21e41a94 100644 Binary files a/panda/board/obj/panda_can_ignition_only.bin.signed and b/panda/board/obj/panda_can_ignition_only.bin.signed differ diff --git a/panda/board/obj/panda_h7.bin.signed b/panda/board/obj/panda_h7.bin.signed index 7c7a811e00..8d17d99d7d 100644 Binary files a/panda/board/obj/panda_h7.bin.signed and b/panda/board/obj/panda_h7.bin.signed differ diff --git a/panda/board/obj/panda_h7_can_ignition_only.bin.signed b/panda/board/obj/panda_h7_can_ignition_only.bin.signed index e380b28da8..aaec2fb3a1 100644 Binary files a/panda/board/obj/panda_h7_can_ignition_only.bin.signed and b/panda/board/obj/panda_h7_can_ignition_only.bin.signed differ diff --git a/panda/board/obj/panda_h7_hkg_remote.bin.signed b/panda/board/obj/panda_h7_hkg_remote.bin.signed index 5f3e1fe967..2818c1f16d 100644 Binary files a/panda/board/obj/panda_h7_hkg_remote.bin.signed and b/panda/board/obj/panda_h7_hkg_remote.bin.signed differ diff --git a/panda/board/obj/panda_h7_hkg_remote_can_ignition_only.bin.signed b/panda/board/obj/panda_h7_hkg_remote_can_ignition_only.bin.signed index a860de571b..e1a4d0c5af 100644 Binary files a/panda/board/obj/panda_h7_hkg_remote_can_ignition_only.bin.signed and b/panda/board/obj/panda_h7_hkg_remote_can_ignition_only.bin.signed differ diff --git a/panda/board/obj/panda_h7_remote.bin.signed b/panda/board/obj/panda_h7_remote.bin.signed index de66d24dbe..e825437ac9 100644 Binary files a/panda/board/obj/panda_h7_remote.bin.signed and b/panda/board/obj/panda_h7_remote.bin.signed differ diff --git a/panda/board/obj/panda_h7_remote_can_ignition_only.bin.signed b/panda/board/obj/panda_h7_remote_can_ignition_only.bin.signed index 077501607d..bbc8ad230d 100644 Binary files a/panda/board/obj/panda_h7_remote_can_ignition_only.bin.signed and b/panda/board/obj/panda_h7_remote_can_ignition_only.bin.signed differ diff --git a/panda/board/obj/panda_h7_tesla_wake.bin.signed b/panda/board/obj/panda_h7_tesla_wake.bin.signed index 44a9baa43c..8e75382b6e 100644 Binary files a/panda/board/obj/panda_h7_tesla_wake.bin.signed and b/panda/board/obj/panda_h7_tesla_wake.bin.signed differ diff --git a/panda/board/obj/panda_h7_tesla_wake_can_ignition_only.bin.signed b/panda/board/obj/panda_h7_tesla_wake_can_ignition_only.bin.signed index 4fbf8c0407..f18ab471b9 100644 Binary files a/panda/board/obj/panda_h7_tesla_wake_can_ignition_only.bin.signed and b/panda/board/obj/panda_h7_tesla_wake_can_ignition_only.bin.signed differ diff --git a/panda/board/obj/panda_hkg_remote.bin.signed b/panda/board/obj/panda_hkg_remote.bin.signed index a5934cd358..56c0d7f7e4 100644 Binary files a/panda/board/obj/panda_hkg_remote.bin.signed and b/panda/board/obj/panda_hkg_remote.bin.signed differ diff --git a/panda/board/obj/panda_hkg_remote_can_ignition_only.bin.signed b/panda/board/obj/panda_hkg_remote_can_ignition_only.bin.signed index 9be461d43c..e09a4f07b1 100644 Binary files a/panda/board/obj/panda_hkg_remote_can_ignition_only.bin.signed and b/panda/board/obj/panda_hkg_remote_can_ignition_only.bin.signed differ diff --git a/panda/board/obj/panda_remote.bin.signed b/panda/board/obj/panda_remote.bin.signed index 4ade7d58a1..ae204e2e76 100644 Binary files a/panda/board/obj/panda_remote.bin.signed and b/panda/board/obj/panda_remote.bin.signed differ diff --git a/panda/board/obj/panda_remote_can_ignition_only.bin.signed b/panda/board/obj/panda_remote_can_ignition_only.bin.signed index f1cfda1d10..1c00d47219 100644 Binary files a/panda/board/obj/panda_remote_can_ignition_only.bin.signed and b/panda/board/obj/panda_remote_can_ignition_only.bin.signed differ diff --git a/panda/board/obj/panda_tesla_wake.bin.signed b/panda/board/obj/panda_tesla_wake.bin.signed index dab35aa1a0..43c87c3673 100644 Binary files a/panda/board/obj/panda_tesla_wake.bin.signed and b/panda/board/obj/panda_tesla_wake.bin.signed differ diff --git a/panda/board/obj/panda_tesla_wake_can_ignition_only.bin.signed b/panda/board/obj/panda_tesla_wake_can_ignition_only.bin.signed index 127ac48333..4b4ad62832 100644 Binary files a/panda/board/obj/panda_tesla_wake_can_ignition_only.bin.signed and b/panda/board/obj/panda_tesla_wake_can_ignition_only.bin.signed differ diff --git a/panda/board/obj/version b/panda/board/obj/version index c176f507c4..60dd48347f 100644 --- a/panda/board/obj/version +++ b/panda/board/obj/version @@ -1 +1 @@ -DEV-968161b3-Pf38f504f-DEBUG \ No newline at end of file +DEV-19d9f323-Pf38f504f-DEBUG \ No newline at end of file diff --git a/panda/tests/libpanda/libpanda.so b/panda/tests/libpanda/libpanda.so index 92d8db819a..4cf97962a4 100755 Binary files a/panda/tests/libpanda/libpanda.so and b/panda/tests/libpanda/libpanda.so differ diff --git a/prebuilt.json b/prebuilt.json index 42d5714b32..50b263e0d8 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "4f231e5a0476cf7eeae651eca98b8d0b1c871e36feab3d5fea00831707b5ca8c", "schema_version": 1} +{"protected_inventory_sha256": "c201320d8500070b856e2c05eb212f5feda30020bb44e71d8946c6c756ebc3bb", "schema_version": 1}