instant boot (#1910)

no more boot time :P
This commit is contained in:
Adeeb Shihadeh 2024-03-22 14:01:44 -07:00 committed by GitHub
parent 091773f448
commit dd82382d5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 6 deletions

View File

@ -117,11 +117,6 @@ void harness_tick(void) {
} }
void harness_init(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 // try to detect orientation
harness.status = harness_detect_orientation(); harness.status = harness_detect_orientation();
if (harness.status != HARNESS_STATUS_NC) { if (harness.status != HARNESS_STATUS_NC) {

View File

@ -304,6 +304,10 @@ class Panda:
for bus in range(PANDA_BUS_CNT): for bus in range(PANDA_BUS_CNT):
self.set_can_speed_kbps(bus, self._can_speed_kbps) self.set_can_speed_kbps(bus, self._can_speed_kbps)
@property
def spi(self) -> bool:
return isinstance(self._handle, PandaSpiHandle)
@classmethod @classmethod
def spi_connect(cls, serial, ignore_version=False): def spi_connect(cls, serial, ignore_version=False):
# get UID to confirm slave is present and up # get UID to confirm slave is present and up

View File

@ -7,4 +7,7 @@ def test_boot_time(p):
st = time.monotonic() st = time.monotonic()
p.reset(reconnect=False) p.reset(reconnect=False)
assert Panda.wait_for_panda(p.get_usb_serial(), timeout=3.0) 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)