diff --git a/opendbc_repo/opendbc/safety/tests/common.py b/opendbc_repo/opendbc/safety/tests/common.py index 2022b9b8bc..01bd80869f 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 488f8deeea..f9d407d2d3 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 3deaaf70ea..72b290d68b 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 7cd3422ffb..ea483bf0a2 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 30fce1179b..432db51f65 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 25899bc5d4..29709e889e 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 2220e6ec9a..88af1466ea 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 164c0b1e84..f2322a6653 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 3af13ab7c7..76336ad582 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 3af13ab7c7..76336ad582 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 7fb5fa5754..4c6f82487f 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 164c0b1e84..f2322a6653 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 da7e7b6a0b..e1e7307ca9 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 e518c51ce6..5b993b34b3 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 25687a7083..1f7f06056a 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 16db3dd87c..b73ff6285f 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 767381b9e6..541d6c5cf6 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 5490f3197e..1bb894ebf2 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 053620c89e..4218dfb875 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 6c432c862a..47135c63f2 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 f8064797b5..18d393b0bb 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 f8c2515bd7..4cedb3f608 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 6108b45be6..65d30202ac 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 bf1446c615..26c9cd09f4 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 507ed0c1cc..1d35db64f8 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 d2c6b6d643..48abf0f9c6 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 3f6125f41c..b797d53021 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 d4abb33e58..464344a9af 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 e1e51f6963..f101b14b15 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 ae56eb12c2..8b3447760e 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 991ff356cd..5003c9cf45 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 4a8830213a..49251b0427 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 d7e4b6054c..d825fff354 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 7c759d735a..7f4b0f5475 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