diff --git a/loop/1_NPM/send_data.py b/loop/1_NPM/send_data.py index 7d7b5d3..d7e0c77 100755 --- a/loop/1_NPM/send_data.py +++ b/loop/1_NPM/send_data.py @@ -227,6 +227,13 @@ def read_complete_response(serial_connection, timeout=2, end_of_response_timeout # Final response and debug output total_elapsed_time = time.time() - start_time 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('') + return response.decode('utf-8', errors='replace') # Open and read the JSON file