mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-08 05:23:41 +08:00
22a8575199
Keep official openpilot ancestry and dependency licenses. Store resources directly in Git, remove LFS setup requirements, and leave the downloadable big model outside the source tree.
50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
import time
|
|
|
|
from panda.tests.hitl.base import PandaTestCase, panda_test
|
|
from panda import Panda
|
|
|
|
class TestMisc(PandaTestCase):
|
|
def test_boot_time(self):
|
|
p = self.p
|
|
# boot time should be instant
|
|
st = time.monotonic()
|
|
p.reset(reconnect=False)
|
|
assert Panda.wait_for_panda(p.get_usb_serial(), timeout=3.0)
|
|
|
|
# USB enumeration is slow, so SPI is faster
|
|
assert time.monotonic() - st < (1.0 if p.spi else 5.0)
|
|
|
|
@panda_test(needs_jungle=True)
|
|
@panda_test(expect_can_error=True)
|
|
@panda_test(panda_types=(Panda.HW_TYPE_CUATRO, ))
|
|
def test_stop_mode(self):
|
|
p = self.p
|
|
panda_jungle = self.panda_jungle
|
|
serial = p.get_usb_serial()
|
|
panda_jungle.set_obd(True)
|
|
|
|
for orientation in (Panda.HARNESS_STATUS_FLIPPED, Panda.HARNESS_STATUS_NORMAL):
|
|
panda_jungle.set_harness_orientation(orientation)
|
|
time.sleep(0.25) # wait for orientation detection
|
|
|
|
for wakeup in ("ign", "0", "1", "2"):
|
|
panda_jungle.set_ignition(False)
|
|
print(f"orientation={orientation} wakeup={wakeup}")
|
|
|
|
p.enter_stop_mode()
|
|
p.close()
|
|
# wait for panda to enter stop mode
|
|
time.sleep(1.5)
|
|
|
|
# wake via ignition or CAN activity
|
|
if wakeup == "ign":
|
|
panda_jungle.set_ignition(True)
|
|
else:
|
|
panda_jungle.can_send(0x123, b'\x01\x02', int(wakeup))
|
|
|
|
# panda should reset and come back
|
|
assert Panda.wait_for_panda(serial, timeout=10)
|
|
|
|
p.reconnect()
|
|
assert p.health()['uptime'] < 3
|