diff --git a/loop/SARA_send_data_v2.py b/loop/SARA_send_data_v2.py index 9a701e9..cdcc344 100755 --- a/loop/SARA_send_data_v2.py +++ b/loop/SARA_send_data_v2.py @@ -714,7 +714,7 @@ try: |_____\___/ \___/|_| ''' - print('
') + print('
', end="") print(response2) print("
", end="") @@ -1039,23 +1039,22 @@ try: print('⚠️ATTENTION: Signal Quality indicates no signal (99)⚠️') #Pas besoin d'essayer de se reconnecter car reconnection automatique - print("TRY TO RECONNECT:") - command = f'AT+COPS=1,2,{selected_networkID}\r' + #print("TRY TO RECONNECT:") + #command = f'AT+COPS=1,2,{selected_networkID}\r' #command = f'AT+COPS=0\r' - ser_sara.write(command.encode('utf-8')) - responseReconnect = read_complete_response(ser_sara, timeout=20, end_of_response_timeout=20, wait_for_lines=["OK", "+CME ERROR", "ERROR"], debug=True) - print('') - print(responseReconnect) - print("
", end="") + #ser_sara.write(command.encode('utf-8')) + #responseReconnect = read_complete_response(ser_sara, timeout=20, end_of_response_timeout=20, wait_for_lines=["OK", "+CME ERROR", "ERROR"], debug=True) + #print('') + #print(responseReconnect) + #print("
", end="") + print('🛑STOP LOOP🛑') print("') + print('
', end="") print(response_SARA_1) print("
", end="") @@ -1091,13 +1090,16 @@ try: print("✅PSD CSD connection reset successfully") else: print("⛔There were issues with the modem CSD PSD reinitialize process") + # Clignotement LED rouge en cas d'erreur + led_thread = Thread(target=blink_led, args=(24, 5, 0.5)) + led_thread.start() #Retreive Socket ID match = re.search(r'\+USOCR:\s*(\d+)', response_SARA_1) if match: socket_id = match.group(1) - print(f"Socket ID: {socket_id}") + print(f"Socket ID: {socket_id}", end="") else: print("Failed to extract socket ID") @@ -1106,24 +1108,24 @@ try: command = f'AT+USOCO={socket_id},"192.168.0.20",4242\r' ser_sara.write(command.encode('utf-8')) response_SARA_2 = read_complete_response(ser_sara, wait_for_lines=["OK", "+CME ERROR", "ERROR"], debug=False) - print('') + print('
', end="") print(response_SARA_2) print("
", end="") # Write data and send - print(f"Write data: {len(binary_data)} bytes") + print(f"Write data: {len(binary_data)} bytes", end="") command = f'AT+USOWR={socket_id},{len(binary_data)}\r' ser_sara.write(command.encode('utf-8')) response_SARA_2 = read_complete_response(ser_sara, wait_for_lines=["@","OK", "+CME ERROR", "ERROR"], debug=False) - print('') + print('
', end="") print(response_SARA_2) print("
", end="") # Send the raw payload bytes (already prepared) ser_sara.write(binary_data) response_SARA_2 = read_complete_response(ser_sara, wait_for_lines=["@","OK", "+CME ERROR", "ERROR"], debug=False) - print('') + print('
', end="") print(response_SARA_2) print("
", end="") @@ -1141,7 +1143,12 @@ try: command = f'AT+USOCL={socket_id}\r' ser_sara.write(command.encode('utf-8')) response_SARA_2 = read_complete_response(ser_sara, wait_for_lines=["OK", "+CME ERROR", "ERROR"], debug=False) - print('') + + #blink green LEDs + led_thread = Thread(target=blink_led, args=(23, 5, 0.5)) + led_thread.start() + + print('
', end="") print(response_SARA_2) print("
", end="")