Avoid trying to adjust the port timeout once it's open; Windows apparently doesn't like this.

This commit is contained in:
px4dev 2012-09-09 22:09:17 -07:00
parent 3140ba658a
commit b871d28c6d
1 changed files with 10 additions and 4 deletions

View File

@ -172,10 +172,16 @@ class uploader(object):
self.__send(uploader.CHIP_ERASE
+ uploader.EOC)
# erase is very slow, give it 10s
old_timeout = self.port.timeout
self.port.timeout = 10
self.__getSync()
self.port.timeout = old_timeout
deadline = time.time() + 10
while time.time() < deadline:
try:
self.__getSync()
return
except RuntimeError as ex:
# we timed out, that's OK
continue
raise RuntimeError("timed out waiting for erase")
# send a PROG_MULTI command to write a collection of bytes
def __program_multi(self, data):