From dd82382d5f9fcfbf9958238ee33739693fd3f6fa Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Fri, 22 Mar 2024 14:01:44 -0700 Subject: [PATCH] instant boot (#1910) no more boot time :P --- board/drivers/harness.h | 5 ----- python/__init__.py | 4 ++++ tests/hitl/8_misc.py | 5 ++++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/board/drivers/harness.h b/board/drivers/harness.h index 60f99fc85..bfe61050a 100644 --- a/board/drivers/harness.h +++ b/board/drivers/harness.h @@ -117,11 +117,6 @@ void harness_tick(void) { } void harness_init(void) { - // delay such that the connection is fully made before trying orientation detection - current_board->set_led(LED_BLUE, true); - delay(10000000); - current_board->set_led(LED_BLUE, false); - // try to detect orientation harness.status = harness_detect_orientation(); if (harness.status != HARNESS_STATUS_NC) { diff --git a/python/__init__.py b/python/__init__.py index f97f608ad..ba1f107d2 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -304,6 +304,10 @@ class Panda: for bus in range(PANDA_BUS_CNT): self.set_can_speed_kbps(bus, self._can_speed_kbps) + @property + def spi(self) -> bool: + return isinstance(self._handle, PandaSpiHandle) + @classmethod def spi_connect(cls, serial, ignore_version=False): # get UID to confirm slave is present and up diff --git a/tests/hitl/8_misc.py b/tests/hitl/8_misc.py index 63e1c3e8c..3c47ed492 100644 --- a/tests/hitl/8_misc.py +++ b/tests/hitl/8_misc.py @@ -7,4 +7,7 @@ def test_boot_time(p): st = time.monotonic() p.reset(reconnect=False) assert Panda.wait_for_panda(p.get_usb_serial(), timeout=3.0) - assert time.monotonic() - st < 3.0 + + # USB enumeration is slow, so SPI is faster + assert time.monotonic() - st < (1.0 if p.spi else 5.0) +