some computers are slow to enumerate

This commit is contained in:
Firmware Batman 2017-08-21 13:32:28 -07:00
parent 37b3327c28
commit 71d81ed916
4 changed files with 17 additions and 6 deletions

View File

@ -27,7 +27,7 @@ bin: obj/$(PROJ_NAME).bin
# this flashes everything
recover: obj/bootstub.$(PROJ_NAME).bin obj/$(PROJ_NAME).bin
-python -c "from panda import Panda; Panda().reset(enter_bootloader=True)"
sleep 0.5
sleep 1.0
$(DFU_UTIL) -a 0 -s 0x08004000 -D obj/$(PROJ_NAME).bin
$(DFU_UTIL) -a 0 -s 0x08000000:leave -D obj/bootstub.$(PROJ_NAME).bin

View File

@ -61,11 +61,21 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, int hardwired) {
case 0xd1:
// this allows reflashing of the bootstub
// so it's blocked over wifi
switch (setup->b.wValue.w) {
case 0:
if (hardwired) {
puts("-> entering bootloader\n");
enter_bootloader_mode = ENTER_BOOTLOADER_MAGIC;
NVIC_SystemReset();
}
break;
case 1:
puts("-> entering softloader\n");
enter_bootloader_mode = ENTER_SOFTLOADER_MAGIC;
NVIC_SystemReset();
break;
}
break;
// **** 0xd6: get version
case 0xd6:
COMPILE_TIME_ASSERT(sizeof(gitversion) <= MAX_RESP_LEN)

View File

@ -136,6 +136,7 @@ class Panda(object):
break
except Exception as e:
print("exception", e)
traceback.print_exc()
if wait == False or self._handle != None:
break
assert(self._handle != None)
@ -154,7 +155,7 @@ class Panda(object):
except Exception:
pass
if not enter_bootloader:
time.sleep(0.5)
time.sleep(1.0)
self.connect()
def flash(self, fn=None):

View File

@ -1,3 +1,3 @@
#!/bin/bash
nosetests -x -s tests/automated/$1*.py
PYTHONPATH="." nosetests -x -s tests/automated/$1*.py