This commit is contained in:
PaulVua
2025-01-23 16:16:42 +01:00
parent 545f5f8f3a
commit bd902a0c46

View File

@@ -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('<span style="color: red;font-weight: bold;"></span>')
print(f"{total_elapsed_time:.2f}s")
print('</span>')
print(f"[ALERT] 🚨 The operation took too long🚨")
print(f'<span style="color: red;font-weight: bold;">[ALERT] ⚠️{total_elapsed_time:.2f}s⚠</span>')
return response.decode('utf-8', errors='replace')
@@ -494,7 +492,6 @@ try:
print('<span style="color: red;font-weight: bold;">ATTENTION: HTTP operation failed</span>')
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'
# Get error code
print("Getting error code")
command = f'AT+UHTTPER={aircarto_profile_id}\r'
ser_sara.write(command.encode('utf-8'))
response_SARA_31 = read_complete_response(ser_sara)
if need_to_log:
print(response_SARA_31)
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: