add name main check

This commit is contained in:
interfisch 2024-07-16 22:36:28 +02:00
parent 64bd6f79f5
commit e31ccb1813
1 changed files with 39 additions and 40 deletions

View File

@ -148,51 +148,50 @@ def delete_file(filename):
exit()
if serialport.isOpen():
establish_connection()
if __name__ == "__main__":
if serialport.isOpen():
establish_connection()
#Get File List
filenames=get_filenames()
#Get File List
filenames=get_filenames()
#Copy all Files
failed=0
#Copy all Files
for filename in filenames:
print("Reading file "+filename)
expectedsize=get_filesize(filename)
print("Expecting "+str(expectedsize)+" Byte")
failed=0
writefilename='sdcard/'+filename
receivedsize=copy_file(filename,writefilename,expectedsize)
for filename in filenames:
print("Reading file "+filename)
expectedsize=get_filesize(filename)
print("Expecting "+str(expectedsize)+" Byte")
if (expectedsize!=receivedsize):
print("Warning: Filesize does not match!")
failed+=1
writefilename='sdcard/'+filename
receivedsize=copy_file(filename,writefilename,expectedsize)
print("")
if (expectedsize!=receivedsize):
print("Warning: Filesize does not match!")
failed+=1
print(str(len(filenames))+" Files copied with "+str(failed)+" failed")
print("")
print(str(len(filenames))+" Files copied with "+str(failed)+" failed")
#Delete all files
'''
log_off()
for filename in filenames:
delete_file(filename)
'''
#Delete all files
'''
log_off()
for filename in filenames:
delete_file(filename)
'''
serialport.write("echo on\n".encode())
serialport.write("echo on\n".encode())
serialport.close()
serialport.close()