mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-21 22:12:05 +08:00
test_models: fix Nidec routes that start enabled (#26305)
* Update test_models.py * Update test_models.py * fix non-pcmCruise routes where button is left pressed in warmup * more explicit, don't allow multiple continues * revert chjange * -that
This commit is contained in:
@@ -219,13 +219,10 @@ class TestCarModelBase(unittest.TestCase):
|
||||
to_send = package_can_msg(msg)
|
||||
self.safety.safety_rx_hook(to_send)
|
||||
|
||||
if not self.CP.pcmCruise:
|
||||
self.safety.set_controls_allowed(0)
|
||||
|
||||
controls_allowed_prev = False
|
||||
CS_prev = car.CarState.new_message()
|
||||
checks = defaultdict(lambda: 0)
|
||||
for can in self.can_msgs:
|
||||
for idx, can in enumerate(self.can_msgs):
|
||||
CS = self.CI.update(CC, (can.as_builder().to_bytes(), ))
|
||||
for msg in can_capnp_to_can_list(can.can, src_filter=range(64)):
|
||||
msg = list(msg)
|
||||
@@ -234,6 +231,14 @@ class TestCarModelBase(unittest.TestCase):
|
||||
ret = self.safety.safety_rx_hook(to_send)
|
||||
self.assertEqual(1, ret, f"safety rx failed ({ret=}): {to_send}")
|
||||
|
||||
# Skip first frame so CS_prev is properly initialized
|
||||
if idx == 0:
|
||||
CS_prev = CS
|
||||
# Button may be left pressed in warm up period
|
||||
if not self.CP.pcmCruise:
|
||||
self.safety.set_controls_allowed(0)
|
||||
continue
|
||||
|
||||
# TODO: check rest of panda's carstate (steering, ACC main on, etc.)
|
||||
|
||||
checks['gasPressed'] += CS.gasPressed != self.safety.get_gas_pressed_prev()
|
||||
|
||||
Reference in New Issue
Block a user