mirror of https://github.com/commaai/panda.git
wait up to 15 seconds, and detect rev c in bootstub
This commit is contained in:
parent
72a92f5610
commit
d01c91faae
|
@ -48,6 +48,11 @@ extern void *_app_start[];
|
|||
int main() {
|
||||
__disable_irq();
|
||||
clock_init();
|
||||
detect();
|
||||
|
||||
if (revision == PANDA_REV_C) {
|
||||
set_usb_power_mode(USB_POWER_CLIENT);
|
||||
}
|
||||
|
||||
if (enter_bootloader_mode == ENTER_SOFTLOADER_MAGIC) {
|
||||
enter_bootloader_mode = 0;
|
||||
|
|
|
@ -164,13 +164,14 @@ class Panda(object):
|
|||
if not enter_bootloader:
|
||||
self.close()
|
||||
time.sleep(1.0)
|
||||
try:
|
||||
self.connect()
|
||||
except Exception:
|
||||
# retry after 5 seconds
|
||||
print("connecting to bootstub is taking a while...")
|
||||
time.sleep(5.0)
|
||||
self.connect()
|
||||
# wait up to 15 seconds
|
||||
for i in range(0, 15):
|
||||
try:
|
||||
self.connect()
|
||||
break
|
||||
except Exception:
|
||||
print("reconnecting is taking %d seconds..." % i)
|
||||
time.sleep(1.0)
|
||||
|
||||
|
||||
def flash(self, fn=None, code=None):
|
||||
|
|
Loading…
Reference in New Issue