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() exit()
if serialport.isOpen():
establish_connection()
if __name__ == "__main__":
#Get File List if serialport.isOpen():
filenames=get_filenames()
establish_connection()
#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 (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()