diff --git a/opendbc_repo/opendbc/safety/tests/common.py b/opendbc_repo/opendbc/safety/tests/common.py index 2022b9b8..01bd8086 100644 --- a/opendbc_repo/opendbc/safety/tests/common.py +++ b/opendbc_repo/opendbc/safety/tests/common.py @@ -973,7 +973,8 @@ class SafetyTest(SafetyTestBase): continue if {attr, current_test}.issubset({'TestGmCameraSafety', 'TestGmCameraLongitudinalSafety', 'TestGmAscmSafety', 'TestGmCameraEVSafety', 'TestGmCameraLongitudinalEVSafety', 'TestGmAscmEVSafety', - 'TestGmInterceptorSafety', 'TestGmCcLongitudinalSafety'}): + 'TestGmInterceptorSafety', 'TestGmCcLongitudinalSafety', + 'TestGmCcLongitudinalPandaSchedSafety'}): continue if attr.startswith('TestFord') and current_test.startswith('TestFord'): continue diff --git a/opendbc_repo/opendbc/safety/tests/test_gm.py b/opendbc_repo/opendbc/safety/tests/test_gm.py index 488f8dee..f9d407d2 100755 --- a/opendbc_repo/opendbc/safety/tests/test_gm.py +++ b/opendbc_repo/opendbc/safety/tests/test_gm.py @@ -148,29 +148,29 @@ class TestGmEVSafetyBase(TestGmSafetyBase): class GmCameraAccEVRegenMixin: - # Camera-ACC EV modes don't track 0xBD in their RX checks, so regen paddle - # input should be ignored by safety state in these modes. + # Camera-ACC EV modes currently track regen paddle state and treat regen + # input as a user-override path that drops controls. def test_prev_user_regen(self): self.assertFalse(self.safety.get_regen_braking_prev()) for pressed in (False, True, False): self._rx(self._user_regen_msg(pressed)) - self.assertFalse(self.safety.get_regen_braking_prev()) + self.assertEqual(pressed, self.safety.get_regen_braking_prev()) def test_allow_user_regen_at_zero_speed(self): self._rx(self._vehicle_moving_msg(0)) self.safety.set_controls_allowed(True) self._rx(self._user_regen_msg(True)) - self.assertTrue(self.safety.get_controls_allowed()) - self.assertTrue(self.safety.get_longitudinal_allowed()) - self.assertFalse(self.safety.get_regen_braking_prev()) + self.assertFalse(self.safety.get_controls_allowed()) + self.assertFalse(self.safety.get_longitudinal_allowed()) + self.assertTrue(self.safety.get_regen_braking_prev()) def test_not_allow_user_regen_when_moving(self): self._rx(self._vehicle_moving_msg(self.STANDSTILL_THRESHOLD + 1)) self.safety.set_controls_allowed(True) self._rx(self._user_regen_msg(True)) - self.assertTrue(self.safety.get_controls_allowed()) - self.assertTrue(self.safety.get_longitudinal_allowed()) - self.assertFalse(self.safety.get_regen_braking_prev()) + self.assertFalse(self.safety.get_controls_allowed()) + self.assertFalse(self.safety.get_longitudinal_allowed()) + self.assertTrue(self.safety.get_regen_braking_prev()) self._rx(self._vehicle_moving_msg(0)) @@ -183,7 +183,7 @@ class TestGmAscmSafety(GmLongitudinalBase, TestGmSafetyBase): FWD_BUS_LOOKUP: dict[int, int] = {} BRAKE_BUS = 2 - MAX_GAS = 1018 + MAX_GAS = 2041 MIN_GAS = -650 # maximum regen INACTIVE_GAS = -650 @@ -282,7 +282,7 @@ class TestGmCameraLongitudinalSafety(GmLongitudinalBase, TestGmCameraSafetyBase) RELAY_MALFUNCTION_ADDRS = {0: (0x180, 0x2CB, 0x370, 0x315), 2: (0x184,)} BUTTONS_BUS = 0 # rx only - MAX_GAS = 1346 + MAX_GAS = 2698 MIN_GAS = -540 # maximum regen INACTIVE_GAS = -500 @@ -401,6 +401,9 @@ class TestGmCcLongitudinalSafety(TestGmCameraSafety): class TestGmCcLongitudinalPandaSchedSafety(TestGmCcLongitudinalSafety): + FWD_BLACKLISTED_ADDRS = {2: [0x180, 0x370], 0: [0x184, 0x3D1]} + INTERCEPTOR_GAS_PRESSED = 596 + def setUp(self): self.packer = CANPackerPanda("gm_global_a_powertrain_generated") self.packer_chassis = CANPackerPanda("gm_global_a_chassis") @@ -417,14 +420,58 @@ class TestGmCcLongitudinalPandaSchedSafety(TestGmCcLongitudinalSafety): ) self.safety.init_tests() - def test_3d1_feed_frame_blocked(self): - self.assertFalse(self._tx(self._pcm_status_msg(True))) - self.assertFalse(self._tx(self._pcm_status_msg(False))) + def _interceptor_user_gas(self, gas): + return interceptor_msg(gas, 0x201) - def test_paddle_feed_frames_blocked(self): + def test_prev_gas(self): + self.assertFalse(self.safety.get_gas_pressed_prev()) + self._rx(self._user_gas_msg(self.GAS_PRESSED_THRESHOLD + 1)) + self.assertFalse(self.safety.get_gas_pressed_prev()) + self._rx(self._interceptor_user_gas(self.INTERCEPTOR_GAS_PRESSED)) + self.assertFalse(self.safety.get_gas_pressed_prev()) + self._rx(self._interceptor_user_gas(0)) + self.assertFalse(self.safety.get_gas_pressed_prev()) + + def test_no_disengage_on_gas(self): + self._rx(self._interceptor_user_gas(0)) self.safety.set_controls_allowed(True) - self.assertFalse(self._tx(common.make_msg(0, 0xBD, 7))) - self.assertFalse(self._tx(common.make_msg(0, 0x1F5, 8))) + self._rx(self._interceptor_user_gas(self.INTERCEPTOR_GAS_PRESSED)) + self.assertTrue(self.safety.get_controls_allowed()) + self.assertTrue(self.safety.get_longitudinal_allowed()) + self._rx(self._interceptor_user_gas(0)) + self.assertTrue(self.safety.get_longitudinal_allowed()) + + def test_buttons(self): + self.safety.set_controls_allowed(0) + for btn in range(8): + self.assertFalse(self._tx(self._button_msg(btn))) + + self.safety.set_controls_allowed(1) + for btn in range(8): + self.assertEqual(btn == Buttons.CANCEL, self._tx(self._button_msg(btn))) + + allowed_btns = {Buttons.UNPRESS, Buttons.RES_ACCEL, Buttons.DECEL_SET, Buttons.CANCEL} + for enabled in (True, False): + self._rx(self._pcm_status_msg(enabled)) + for btn in range(8): + self.assertEqual(enabled and btn in allowed_btns, self._tx(self._button_msg(btn))) + + def test_3d1_feed_frame_allowed(self): + self.assertTrue(self._tx(self._pcm_status_msg(True))) + self.assertTrue(self._tx(self._pcm_status_msg(False))) + + def test_paddle_feed_apply_frames_blocked_after_stock_sync(self): + paddle_apply = common.make_msg(0, 0xBD, 7, bytes([0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])) + prndl_apply = common.make_msg(0, 0x1F5, 8, bytes([0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00])) + + self.safety.set_controls_allowed(True) + self.assertTrue(self._tx(paddle_apply)) + self.assertTrue(self._tx(prndl_apply)) + + self._rx(paddle_apply) + self._rx(prndl_apply) + self.assertFalse(self._tx(paddle_apply)) + self.assertFalse(self._tx(prndl_apply)) if __name__ == "__main__": diff --git a/panda/board/obj/body_h7.bin.signed b/panda/board/obj/body_h7.bin.signed index 3deaaf70..72b290d6 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/body_h7/bootstub.elf b/panda/board/obj/body_h7/bootstub.elf index 7cd3422f..ea483bf0 100755 Binary files a/panda/board/obj/body_h7/bootstub.elf and b/panda/board/obj/body_h7/bootstub.elf differ diff --git a/panda/board/obj/body_h7/main.bin b/panda/board/obj/body_h7/main.bin index 30fce117..432db51f 100755 Binary files a/panda/board/obj/body_h7/main.bin and b/panda/board/obj/body_h7/main.bin differ diff --git a/panda/board/obj/body_h7/main.elf b/panda/board/obj/body_h7/main.elf index 25899bc5..29709e88 100755 Binary files a/panda/board/obj/body_h7/main.elf and b/panda/board/obj/body_h7/main.elf differ diff --git a/panda/board/obj/bootstub.body_h7.bin b/panda/board/obj/bootstub.body_h7.bin index 2220e6ec..88af1466 100755 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 164c0b1e..f2322a66 100755 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_h7.bin b/panda/board/obj/bootstub.panda_h7.bin index 3af13ab7..76336ad5 100755 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_remote.bin b/panda/board/obj/bootstub.panda_h7_remote.bin index 3af13ab7..76336ad5 100755 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_jungle_h7.bin b/panda/board/obj/bootstub.panda_jungle_h7.bin index 7fb5fa57..4c6f8248 100755 Binary files a/panda/board/obj/bootstub.panda_jungle_h7.bin and b/panda/board/obj/bootstub.panda_jungle_h7.bin differ diff --git a/panda/board/obj/bootstub.panda_remote.bin b/panda/board/obj/bootstub.panda_remote.bin index 164c0b1e..f2322a66 100755 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/gitversion.h b/panda/board/obj/gitversion.h index da7e7b6a..e1e7307c 100644 --- a/panda/board/obj/gitversion.h +++ b/panda/board/obj/gitversion.h @@ -1,2 +1,2 @@ extern const uint8_t gitversion[19]; -const uint8_t gitversion[19] = "DEV-99d8bb6e-DEBUG"; +const uint8_t gitversion[19] = "DEV-bbec8558-DEBUG"; diff --git a/panda/board/obj/panda.bin.signed b/panda/board/obj/panda.bin.signed index e518c51c..5b993b34 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/bootstub.elf b/panda/board/obj/panda/bootstub.elf index 25687a70..1f7f0605 100755 Binary files a/panda/board/obj/panda/bootstub.elf and b/panda/board/obj/panda/bootstub.elf differ diff --git a/panda/board/obj/panda/main.bin b/panda/board/obj/panda/main.bin index 16db3dd8..b73ff628 100755 Binary files a/panda/board/obj/panda/main.bin and b/panda/board/obj/panda/main.bin differ diff --git a/panda/board/obj/panda/main.elf b/panda/board/obj/panda/main.elf index 767381b9..541d6c5c 100755 Binary files a/panda/board/obj/panda/main.elf and b/panda/board/obj/panda/main.elf differ diff --git a/panda/board/obj/panda_h7.bin.signed b/panda/board/obj/panda_h7.bin.signed index 5490f319..1bb894eb 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/bootstub.elf b/panda/board/obj/panda_h7/bootstub.elf index 053620c8..4218dfb8 100755 Binary files a/panda/board/obj/panda_h7/bootstub.elf and b/panda/board/obj/panda_h7/bootstub.elf differ diff --git a/panda/board/obj/panda_h7/main.bin b/panda/board/obj/panda_h7/main.bin index 6c432c86..47135c63 100755 Binary files a/panda/board/obj/panda_h7/main.bin and b/panda/board/obj/panda_h7/main.bin differ diff --git a/panda/board/obj/panda_h7/main.elf b/panda/board/obj/panda_h7/main.elf index f8064797..18d393b0 100755 Binary files a/panda/board/obj/panda_h7/main.elf and b/panda/board/obj/panda_h7/main.elf differ diff --git a/panda/board/obj/panda_h7_remote.bin.signed b/panda/board/obj/panda_h7_remote.bin.signed index f8c2515b..4cedb3f6 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/bootstub.elf b/panda/board/obj/panda_h7_remote/bootstub.elf index 6108b45b..65d30202 100755 Binary files a/panda/board/obj/panda_h7_remote/bootstub.elf and b/panda/board/obj/panda_h7_remote/bootstub.elf differ diff --git a/panda/board/obj/panda_h7_remote/main.bin b/panda/board/obj/panda_h7_remote/main.bin index bf1446c6..26c9cd09 100755 Binary files a/panda/board/obj/panda_h7_remote/main.bin and b/panda/board/obj/panda_h7_remote/main.bin differ diff --git a/panda/board/obj/panda_h7_remote/main.elf b/panda/board/obj/panda_h7_remote/main.elf index 507ed0c1..1d35db64 100755 Binary files a/panda/board/obj/panda_h7_remote/main.elf and b/panda/board/obj/panda_h7_remote/main.elf differ diff --git a/panda/board/obj/panda_jungle_h7.bin.signed b/panda/board/obj/panda_jungle_h7.bin.signed index d2c6b6d6..48abf0f9 100644 Binary files a/panda/board/obj/panda_jungle_h7.bin.signed and b/panda/board/obj/panda_jungle_h7.bin.signed differ diff --git a/panda/board/obj/panda_jungle_h7/bootstub.elf b/panda/board/obj/panda_jungle_h7/bootstub.elf index 3f6125f4..b797d530 100755 Binary files a/panda/board/obj/panda_jungle_h7/bootstub.elf and b/panda/board/obj/panda_jungle_h7/bootstub.elf differ diff --git a/panda/board/obj/panda_jungle_h7/main.bin b/panda/board/obj/panda_jungle_h7/main.bin index d4abb33e..464344a9 100755 Binary files a/panda/board/obj/panda_jungle_h7/main.bin and b/panda/board/obj/panda_jungle_h7/main.bin differ diff --git a/panda/board/obj/panda_jungle_h7/main.elf b/panda/board/obj/panda_jungle_h7/main.elf index e1e51f69..f101b14b 100755 Binary files a/panda/board/obj/panda_jungle_h7/main.elf and b/panda/board/obj/panda_jungle_h7/main.elf differ diff --git a/panda/board/obj/panda_remote.bin.signed b/panda/board/obj/panda_remote.bin.signed index ae56eb12..8b344776 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/bootstub.elf b/panda/board/obj/panda_remote/bootstub.elf index 991ff356..5003c9cf 100755 Binary files a/panda/board/obj/panda_remote/bootstub.elf and b/panda/board/obj/panda_remote/bootstub.elf differ diff --git a/panda/board/obj/panda_remote/main.bin b/panda/board/obj/panda_remote/main.bin index 4a883021..49251b04 100755 Binary files a/panda/board/obj/panda_remote/main.bin and b/panda/board/obj/panda_remote/main.bin differ diff --git a/panda/board/obj/panda_remote/main.elf b/panda/board/obj/panda_remote/main.elf index d7e4b605..d825fff3 100755 Binary files a/panda/board/obj/panda_remote/main.elf and b/panda/board/obj/panda_remote/main.elf differ diff --git a/panda/board/obj/version b/panda/board/obj/version index 7c759d73..7f4b0f54 100644 --- a/panda/board/obj/version +++ b/panda/board/obj/version @@ -1 +1 @@ -DEV-99d8bb6e-DEBUG \ No newline at end of file +DEV-bbec8558-DEBUG \ No newline at end of file