update
This commit is contained in:
@@ -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. ⏱️")
|
print(f"[DEBUG] ⏱️ elapsed time: {total_elapsed_time:.2f}s. ⏱️")
|
||||||
# Check if the elapsed time exceeded 10 seconds
|
# Check if the elapsed time exceeded 10 seconds
|
||||||
if total_elapsed_time > 10:
|
if total_elapsed_time > 10:
|
||||||
print(f"[ALERT] 🚨 The operation took too long: {total_elapsed_time:.2f}s. 🚨")
|
print(f"[ALERT] 🚨 The operation took too long🚨")
|
||||||
print('<span style="color: red;font-weight: bold;"></span>')
|
print(f'<span style="color: red;font-weight: bold;">[ALERT] ⚠️{total_elapsed_time:.2f}s⚠️</span>')
|
||||||
print(f"{total_elapsed_time:.2f}s")
|
|
||||||
print('</span>')
|
|
||||||
|
|
||||||
return response.decode('utf-8', errors='replace')
|
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>')
|
print('<span style="color: red;font-weight: bold;">ATTENTION: HTTP operation failed</span>')
|
||||||
update_json_key(config_file, "SARA_R4_network_status", "disconnected")
|
update_json_key(config_file, "SARA_R4_network_status", "disconnected")
|
||||||
print("*****")
|
print("*****")
|
||||||
print("resetting the URL (domain name):")
|
|
||||||
print("Turning off the blue LED...")
|
print("Turning off the blue LED...")
|
||||||
for _ in range(4): # Faire clignoter 4 fois
|
for _ in range(4): # Faire clignoter 4 fois
|
||||||
GPIO.output(23, GPIO.HIGH) # Allumer la LED
|
GPIO.output(23, GPIO.HIGH) # Allumer la LED
|
||||||
@@ -502,11 +499,33 @@ try:
|
|||||||
GPIO.output(23, GPIO.LOW) # Éteindre la LED
|
GPIO.output(23, GPIO.LOW) # Éteindre la LED
|
||||||
time.sleep(0.1) # Attendre 100 ms
|
time.sleep(0.1) # Attendre 100 ms
|
||||||
GPIO.output(23, GPIO.LOW) # Turn off the LED
|
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'))
|
# Get error code
|
||||||
response_SARA_31 = read_complete_response(ser_sara)
|
print("Getting error code")
|
||||||
if need_to_log:
|
command = f'AT+UHTTPER={aircarto_profile_id}\r'
|
||||||
print(response_SARA_31)
|
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)
|
# 2.2 code 1 (HHTP succeded)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user