mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-23 08:45:48 +08:00
Add proper exit code and success message
This commit is contained in:
@@ -85,23 +85,26 @@ def transferFile(ser, filename, fSize):
|
|||||||
if "\x05" in r:
|
if "\x05" in r:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
|
print
|
||||||
|
return False
|
||||||
break
|
break
|
||||||
print
|
print
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def upload(ser, filename, checkModel=None):
|
def upload(ser, filename, checkModel=None):
|
||||||
if not getBaudrate(ser, os.path.getsize(filename), checkModel):
|
if not getBaudrate(ser, os.path.getsize(filename), checkModel):
|
||||||
print 'could not find baudrate'
|
print 'Could not find baudrate'
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
if not setDownloadBaudrate(ser, os.path.getsize(filename), 115200):
|
if not setDownloadBaudrate(ser, os.path.getsize(filename), 115200):
|
||||||
print 'could not set download baudrate'
|
print 'Could not set download baudrate'
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
if not transferFile(ser, filename, os.path.getsize(filename)):
|
if not transferFile(ser, filename, os.path.getsize(filename)):
|
||||||
print 'could not transfer file'
|
print 'Could not transfer file'
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
print 'File transferred successfully'
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user