mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-22 16:25:45 +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:
|
||||
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__":
|
||||
|
||||
Reference in New Issue
Block a user