wait up to 15 seconds, and detect rev c in bootstub

This commit is contained in:
George Hotz 2017-08-25 12:02:26 -07:00
parent 72a92f5610
commit d01c91faae
2 changed files with 13 additions and 7 deletions

View File

@ -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;

View File

@ -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):