add name main check
This commit is contained in:
parent
64bd6f79f5
commit
e31ccb1813
|
@ -148,51 +148,50 @@ def delete_file(filename):
|
|||
exit()
|
||||
|
||||
|
||||
if serialport.isOpen():
|
||||
|
||||
establish_connection()
|
||||
|
||||
|
||||
|
||||
#Get File List
|
||||
filenames=get_filenames()
|
||||
|
||||
|
||||
#Copy all Files
|
||||
failed=0
|
||||
|
||||
for filename in filenames:
|
||||
print("Reading file "+filename)
|
||||
expectedsize=get_filesize(filename)
|
||||
print("Expecting "+str(expectedsize)+" Byte")
|
||||
|
||||
writefilename='sdcard/'+filename
|
||||
receivedsize=copy_file(filename,writefilename,expectedsize)
|
||||
if __name__ == "__main__":
|
||||
if serialport.isOpen():
|
||||
|
||||
establish_connection()
|
||||
|
||||
if (expectedsize!=receivedsize):
|
||||
print("Warning: Filesize does not match!")
|
||||
failed+=1
|
||||
|
||||
print("")
|
||||
|
||||
print(str(len(filenames))+" Files copied with "+str(failed)+" failed")
|
||||
|
||||
|
||||
|
||||
#Delete all files
|
||||
'''
|
||||
log_off()
|
||||
for filename in filenames:
|
||||
delete_file(filename)
|
||||
'''
|
||||
|
||||
|
||||
|
||||
|
||||
serialport.write("echo on\n".encode())
|
||||
#Get File List
|
||||
filenames=get_filenames()
|
||||
|
||||
|
||||
|
||||
#Copy all Files
|
||||
|
||||
failed=0
|
||||
|
||||
for filename in filenames:
|
||||
print("Reading file "+filename)
|
||||
expectedsize=get_filesize(filename)
|
||||
print("Expecting "+str(expectedsize)+" Byte")
|
||||
|
||||
serialport.close()
|
||||
writefilename='sdcard/'+filename
|
||||
receivedsize=copy_file(filename,writefilename,expectedsize)
|
||||
|
||||
if (expectedsize!=receivedsize):
|
||||
print("Warning: Filesize does not match!")
|
||||
failed+=1
|
||||
|
||||
print("")
|
||||
|
||||
print(str(len(filenames))+" Files copied with "+str(failed)+" failed")
|
||||
|
||||
|
||||
|
||||
#Delete all files
|
||||
|
||||
'''
|
||||
log_off()
|
||||
for filename in filenames:
|
||||
delete_file(filename)
|
||||
'''
|
||||
|
||||
|
||||
serialport.write("echo on\n".encode())
|
||||
|
||||
serialport.close()
|
||||
|
||||
|
|
Loading…
Reference in New Issue