Add proper exit code and success message

This commit is contained in:
phl0
2016-11-08 21:45:52 +01:00
parent 2b80ca7732
commit 6f3b581123

View File

@@ -85,23 +85,26 @@ def transferFile(ser, filename, fSize):
if "\x05" in r:
continue
else:
print
return False
break
print
return True
def upload(ser, filename, checkModel=None):
if not getBaudrate(ser, os.path.getsize(filename), checkModel):
print 'could not find baudrate'
print 'Could not find baudrate'
exit(1)
if not setDownloadBaudrate(ser, os.path.getsize(filename), 115200):
print 'could not set download baudrate'
print 'Could not set download baudrate'
exit(1)
if not transferFile(ser, filename, os.path.getsize(filename)):
print 'could not transfer file'
print 'Could not transfer file'
exit(1)
print 'File transferred successfully'
exit(0)
if __name__ == "__main__":