diff --git a/opendbc_repo/opendbc/safety/tests/common.py b/opendbc_repo/opendbc/safety/tests/common.py index 2022b9b8b..01bd80869 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 488f8deee..f9d407d2d 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 3deaaf70e..72b290d68 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 7cd3422ff..ea483bf0a 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 30fce1179..432db51f6 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 25899bc5d..29709e889 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 2220e6ec9..88af1466e 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 164c0b1e8..f2322a665 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 3af13ab7c..76336ad58 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 3af13ab7c..76336ad58 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 7fb5fa575..4c6f82487 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 164c0b1e8..f2322a665 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 da7e7b6a0..e1e7307ca 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 e518c51ce..5b993b34b 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 25687a708..1f7f06056 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 16db3dd87..b73ff6285 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 767381b9e..541d6c5cf 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 5490f3197..1bb894ebf 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 053620c89..4218dfb87 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 6c432c862..47135c63f 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 f8064797b..18d393b0b 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 f8c2515bd..4cedb3f60 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 6108b45be..65d30202a 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 bf1446c61..26c9cd09f 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 507ed0c1c..1d35db64f 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 d2c6b6d64..48abf0f9c 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 3f6125f41..b797d5302 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 d4abb33e5..464344a9a 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 e1e51f696..f101b14b1 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 ae56eb12c..8b3447760 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 991ff356c..5003c9cf4 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 4a8830213..49251b042 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 d7e4b6054..d825fff35 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 7c759d735..7f4b0f547 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