From 2986004b88f1408f8c1f07a68baf8cca691958b5 Mon Sep 17 00:00:00 2001 From: Orell-Pieter Schwarzbach <2122623@stud.hs-mannheim.de> Date: Thu, 25 May 2023 10:21:14 +0200 Subject: [PATCH] Update 'pi_numbers_separated_I2C_function.py' changed to first test a 200.000 bit number then return a new generated number --- pi_numbers_separated_I2C_function.py | 38 ++++++++++++---------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/pi_numbers_separated_I2C_function.py b/pi_numbers_separated_I2C_function.py index 9e468c6..70821d9 100644 --- a/pi_numbers_separated_I2C_function.py +++ b/pi_numbers_separated_I2C_function.py @@ -115,30 +115,24 @@ def analyze_data(num_numbers, bits_per_number, startup=False): os.unlink(binary_filename) else: - 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) + filename = read_data(10, 20000) + binary_filename = convert_to_binary(filename, 10, 20000) 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 - hex_return = f.read() - print(hex_return) - os.unlink(filename) - os.unlink(hex_filename) - os.unlink(binary_filename) - if result: - return hex_return - 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 + hex_return = f.read() + os.unlink(filename) + os.unlink(binary_filename) + os.unlink(hex_filename) + return hex_return + else: + return False # Teste den Code result = analyze_data(50, 2560, startup=False)