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__":
if serialport.isOpen():
establish_connection()
#Get File List #Get File List
filenames=get_filenames() filenames=get_filenames()
#Copy all Files #Copy all Files
failed=0
for filename in filenames: failed=0
print("Reading file "+filename)
expectedsize=get_filesize(filename)
print("Expecting "+str(expectedsize)+" Byte")
writefilename='sdcard/'+filename for filename in filenames:
receivedsize=copy_file(filename,writefilename,expectedsize) print("Reading file "+filename)
expectedsize=get_filesize(filename)
print("Expecting "+str(expectedsize)+" Byte")
if (expectedsize!=receivedsize): writefilename='sdcard/'+filename
print("Warning: Filesize does not match!") receivedsize=copy_file(filename,writefilename,expectedsize)
failed+=1
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 #Delete all files
'''
log_off() '''
for filename in filenames: log_off()
delete_file(filename) for filename in filenames:
''' delete_file(filename)
'''
serialport.write("echo on\n".encode())
serialport.close()
serialport.write("echo on\n".encode())
serialport.close()