diff --git a/board/build.mk b/board/build.mk index a65bd54..d14e93e 100644 --- a/board/build.mk +++ b/board/build.mk @@ -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 diff --git a/board/spi_flasher.h b/board/spi_flasher.h index 8db2a85..8c38cdc 100644 --- a/board/spi_flasher.h +++ b/board/spi_flasher.h @@ -61,9 +61,19 @@ 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 - if (hardwired) { - enter_bootloader_mode = ENTER_BOOTLOADER_MAGIC; - NVIC_SystemReset(); + 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 diff --git a/panda/__init__.py b/panda/__init__.py index 5cd61ac..58a7bd6 100644 --- a/panda/__init__.py +++ b/panda/__init__.py @@ -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): diff --git a/run_automated_tests.sh b/run_automated_tests.sh index 23d8048..d7b7541 100755 --- a/run_automated_tests.sh +++ b/run_automated_tests.sh @@ -1,3 +1,3 @@ #!/bin/bash -nosetests -x -s tests/automated/$1*.py +PYTHONPATH="." nosetests -x -s tests/automated/$1*.py