diff --git a/loop/1_NPM/send_data.py b/loop/1_NPM/send_data.py
index 5b77901..e16e02e 100755
--- a/loop/1_NPM/send_data.py
+++ b/loop/1_NPM/send_data.py
@@ -229,10 +229,8 @@ def read_complete_response(serial_connection, timeout=2, end_of_response_timeout
print(f"[DEBUG] ⏱️ elapsed time: {total_elapsed_time:.2f}s. ⏱️")
# Check if the elapsed time exceeded 10 seconds
if total_elapsed_time > 10:
- print(f"[ALERT] 🚨 The operation took too long: {total_elapsed_time:.2f}s. 🚨")
- print('')
- print(f"{total_elapsed_time:.2f}s")
- print('')
+ print(f"[ALERT] 🚨 The operation took too long🚨")
+ print(f'[ALERT] ⚠️{total_elapsed_time:.2f}s⚠️')
return response.decode('utf-8', errors='replace')
@@ -494,7 +492,6 @@ try:
print('ATTENTION: HTTP operation failed')
update_json_key(config_file, "SARA_R4_network_status", "disconnected")
print("*****")
- print("resetting the URL (domain name):")
print("Turning off the blue LED...")
for _ in range(4): # Faire clignoter 4 fois
GPIO.output(23, GPIO.HIGH) # Allumer la LED
@@ -502,11 +499,33 @@ try:
GPIO.output(23, GPIO.LOW) # Éteindre la LED
time.sleep(0.1) # Attendre 100 ms
GPIO.output(23, GPIO.LOW) # Turn off the LED
- command = f'AT+UHTTP={aircarto_profile_id},1,"{url_nebuleair}"\r'
- ser_sara.write(command.encode('utf-8'))
- response_SARA_31 = read_complete_response(ser_sara)
- if need_to_log:
- print(response_SARA_31)
+
+ # Get error code
+ print("Getting error code")
+ command = f'AT+UHTTPER={aircarto_profile_id}\r'
+ ser_sara.write(command.encode('utf-8'))
+ response_SARA_9 = read_complete_response(ser_sara, wait_for_line="OK")
+ print(response_SARA_9)
+
+ '''
+ +UHTTPER: profile_id,error_class,error_code
+
+ error_class
+ 0 OK, no error
+ 3 HTTP Protocol error class
+ 10 Wrong HTTP API USAGE
+
+ error_code
+ 0 No error
+ 73 Secure socket connect error
+ '''
+
+ #Pas forcément un moyen de résoudre le soucis
+ #print("resetting the URL (domain name):")
+ #command = f'AT+UHTTP={aircarto_profile_id},1,"{url_nebuleair}"\r'
+ #ser_sara.write(command.encode('utf-8'))
+ #response_SARA_31 = read_complete_response(ser_sara)
+ #print(response_SARA_31)
# 2.2 code 1 (HHTP succeded)
else: