mirror of https://github.com/commaai/panda.git
pedal usbflash works
This commit is contained in:
parent
585d0f9e6a
commit
f7a0ab09bf
|
@ -18,7 +18,11 @@ DFU_UTIL = "dfu-util"
|
|||
CERT = ../../certs/debug
|
||||
CFLAGS += "-DALLOW_DEBUG"
|
||||
|
||||
all: obj/bootstub.bin obj/$(PROJ_NAME).bin
|
||||
usbflash: obj/$(PROJ_NAME).bin
|
||||
../../tests/pedal/enter_canloader.py
|
||||
PYTHONPATH=../../ python -c "from python import Panda; p = Panda(); assert(p.bootstub); p.flash('obj/$(PROJ_NAME).bin', reconnect=False)"
|
||||
|
||||
recover: obj/bootstub.bin obj/$(PROJ_NAME).bin
|
||||
$(DFU_UTIL) -d 0483:df11 -a 0 -s 0x08004000 -D obj/$(PROJ_NAME).bin
|
||||
$(DFU_UTIL) -d 0483:df11 -a 0 -s 0x08000000:leave -D obj/bootstub.bin
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ class Panda(object):
|
|||
assert(self._handle != None)
|
||||
print("connected")
|
||||
|
||||
def reset(self, enter_bootstub=False, enter_bootloader=False):
|
||||
def reset(self, enter_bootstub=False, enter_bootloader=False, reconnect=True):
|
||||
# reset
|
||||
try:
|
||||
if enter_bootloader:
|
||||
|
@ -184,6 +184,8 @@ class Panda(object):
|
|||
pass
|
||||
if not enter_bootloader:
|
||||
self.close()
|
||||
if reconnect == False:
|
||||
return
|
||||
time.sleep(1.0)
|
||||
success = False
|
||||
# wait up to 15 seconds
|
||||
|
@ -203,7 +205,7 @@ class Panda(object):
|
|||
if not success:
|
||||
raise Exception("reset failed")
|
||||
|
||||
def flash(self, fn=None, code=None):
|
||||
def flash(self, fn=None, code=None, reconnect=True):
|
||||
if not self.bootstub:
|
||||
self.reset(enter_bootstub=True)
|
||||
assert(self.bootstub)
|
||||
|
@ -247,7 +249,7 @@ class Panda(object):
|
|||
|
||||
# reset
|
||||
print("flash: resetting")
|
||||
self.reset()
|
||||
self.reset(reconnect=reconnect)
|
||||
|
||||
def recover(self):
|
||||
self.reset(enter_bootloader=True)
|
||||
|
|
Loading…
Reference in New Issue