Update 'pi_numbers_separated_I2C_function.py'

changed to first test a 200.000 bit number then return a new generated number
main
Orell-Pieter Schwarzbach 2023-05-25 10:21:14 +02:00
parent 1ec42b3555
commit 2986004b88
1 changed files with 16 additions and 22 deletions

View File

@ -115,30 +115,24 @@ def analyze_data(num_numbers, bits_per_number, startup=False):
os.unlink(binary_filename) os.unlink(binary_filename)
else: else:
filename = read_data(num_numbers, bits_per_number) filename = read_data(10, 20000)
binary_filename = convert_to_binary(filename, num_numbers, bits_per_number) binary_filename = convert_to_binary(filename, 10, 20000)
hex_filename = convert_to_hex(binary_filename, num_numbers, bits_per_number)
result = perform_tot_online_tests(binary_filename) result = perform_tot_online_tests(binary_filename)
with open(hex_filename, 'rb') as f: os.unlink(filename)
os.unlink(binary_filename)
if result:
filename = read_data(num_numbers, bits_per_number)
binary_filename = convert_to_binary(filename, num_numbers, bits_per_number)
hex_filename = convert_to_hex(binary_filename, num_numbers, bits_per_number)
with open(hex_filename, 'rb') as f:
# Read the contents of the file as bytes # Read the contents of the file as bytes
hex_return = f.read() hex_return = f.read()
print(hex_return) os.unlink(filename)
os.unlink(filename) os.unlink(binary_filename)
os.unlink(hex_filename) os.unlink(hex_filename)
os.unlink(binary_filename) return hex_return
if result: else:
return hex_return return False
else:
filename = read_data(10, 80000)
binary_filename = convert_to_binary(filename, 10, 80000)
SUTres = perform_startup_tests(binary_filename)
TOTres = perform_tot_online_tests(binary_filename)
if SUTres and TOTres:
os.unlink(filename)
os.unlink(binary_filename)
return hex_return
else:
return False
# Teste den Code # Teste den Code
result = analyze_data(50, 2560, startup=False) result = analyze_data(50, 2560, startup=False)