mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-06-08 07:45:00 +08:00
Reduce panda power usage (#2340)
* add bootkick for ship mode * boot standby * comment * stop mode * fix som status * exti wakeup * all standby * clean * analog mode * adc * clean * HSI * stop only cuatro * comments * UM2331 * rm * comment * enforce SAFETY_SILENT * clean * misra * rm * disable pulls * assert * Revert "disable pulls" This reverts commit 3b954b929a5f864279d52e28a01768ca22962810. * pull note * add stop mode USB cmd * add stop mode to HITL * fix * async stop mode request * test all harness/ign configs * more time * use uptime * print debug * unstuck * show prints * more * logger * loglevel * log * uptime test * tighter timing * print wakeout source * rm debug * clean * robust * add CAN2 * test more cans * clean * more * longer * multiple * more * can1 * reorder * normal * clean * partial * clean * test * time * delay * reset * setup * reset * revert * silent * fix ordering * no random * warnings * err * timings * heartbeat * time * faster * can1 * simpler * test 20x * put back random * clean * comment * jenkinsfile * final
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import time
|
||||
import pytest
|
||||
|
||||
from panda import Panda
|
||||
|
||||
@@ -11,3 +12,33 @@ def test_boot_time(p):
|
||||
# USB enumeration is slow, so SPI is faster
|
||||
assert time.monotonic() - st < (1.0 if p.spi else 5.0)
|
||||
|
||||
@pytest.mark.panda_expect_can_error
|
||||
@pytest.mark.test_panda_types((Panda.HW_TYPE_CUATRO, ))
|
||||
def test_stop_mode(p, 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
|
||||
|
||||
Reference in New Issue
Block a user